I have a parameter of PHP of $test1, I want to add some scenario in JS which if $test1 exists, it will show some coding in JavaScript. I have drafted some code as follow and it doesn't work. What may it cause?
<script type="text/javascript"><!--
myChart.setXMLData("
"<categories>" +
"<category label='1'/>" +
"<category label='2'/>" +
"</categories>" +
if($test1['transactions_tmp']) {
"<dataset>" +
"<set value='147400'/>" +
"<set value='189100'/>" +
"</dataset>" +
}
"</chart>");
// -->
</script>