I have to echo the below JavaScript code with using only one <?php
tag. How to escape <?php
inside the echo?
<script type="text/javascript">
function drawLatestTen() {
var data = google.visualization.arrayToDataTable(<?php echo json_encode( $json ); ?>);
var ac = new google.visualization.ComboChart(document.getElementById('ipt_dolt_ten_stat'));
ac.draw(data, {
title : '<?php _e( 'Last 30 days form submission statistics', 'ipt_dolt' ); ?>',
height : 300,
vAxis : {title : '<?php _e( 'Submission Hits', 'ipt_dolt' ) ?>'},
hAxis : {title : '<?php _e( 'Date', 'ipt_dolt' ); ?>'},
seriesType : 'bars',
series : {<?php echo count( $json[0] ) - 2; ?> : {type : 'line'}},
legend : {position : 'top'},
tooltip : {isHTML : true}
});
}
</script>
so the result is:
<?php echo '<script type="text/javascript">
function drawLatestTen() {
var data = google.visualization.arrayToDataTable(<?php echo json_encode( $json ); ?>);
var ac = new google.visualization.ComboChart(document.getElementById(\'ipt_dolt_ten_stat\'));
ac.draw(data, {
title : \'<?php _e( \'Last 30 days form submission statistics\', \'ipt_dolt\' ); ?>\',
height : 300,
vAxis : {title : \'<?php _e( \'Submission Hits\', \'ipt_dolt\' ) ?>'},
hAxis : {title : \'<?php _e( \'Date\', \'ipt_dolt\' ); ?>\'},
seriesType : \'bars\',
series : {<?php echo count( $json[0] ) - 2; ?> : {type : \'line\'}},
legend : {position : \'top\'},
tooltip : {isHTML : true}
}); ?>
}
</script>'; ?>