Within the code snippet below, there is a condition written as
(if (epsflag==0)<?php $a=",hide:'true'";?> )
. I am looking to achieve the same condition using JavaScript. Essentially, I want to conditionally utilize a JavaScript variable in my JSON structure. Any assistance with this matter would be greatly appreciated. If my question is unclear, please do not hesitate to let me know.
{display: 'Wave Name', name : 'wavename', sortable : true, align: 'left'<?php echo "$a"?>}
<script type="text/javascript>
function rowdata(epsflag,respflag){
if (epsflag==0) {
<?php $a=",hide:'true'";?>
} else {
<?php $a=",hide:'false'";?>
}
$("#flex1").flexigrid({
url: myurl,
dataType: 'json',
colModel : [
{display: 'Nr.', name : 'nr', sortable : true, align: 'center',width:25},
{display: 'Datum', name : 'consultationdate', sortable : true, align: 'left'},
{display: 'Wave Name', name : 'wavename', sortable : true, align: 'left'<?php echo "$a"?>},
{display: 'Name', name : 'respname', sortable : true, align: 'left'},
{display: 'E-mail', name : 'email', sortable : true, align: 'left',width:180},
{display: 'Telefoon', name : 'telefoon', sortable : true, align: 'left'},
{display: 'Medewerker', name : 'consultationwith', sortable : true, align: 'left'}
],
});
}