I want to update a PHP variable $LinkOpen
based on the current state of a checkbox element .avflipswitch
.
Based on the .avflipswitch
checkbox state, I want to toggle the value of my PHP variable $LinkOpen
between '_blank'
and '_self'
so I can push that value to my Google CSE link target attribute.
What I have tried so far:
$('.avflipswitch').on("change", function (e){
if(this.checked){
functionOne(<?php $LinkOpen = '_blank';?>);
}
else{
functionTwo(<?php $LinkOpen = '_self';?>);
}
});
<gcse:searchresults-only linktarget="<?php echo $LinkOpen;?>"></gcse:searchresults-only>