Assign Jquery array to php session array? -
i have little confusion while assigning jquery array php array, have multiple checkboxes on page, want assign value on click event, retrieve values perfectly, fails assign php array, here code during testing, want assign php session after working:
function updatesession() { var allvals = []; <?php $ids = array()?> $('#c_b :checked').each(function() { allvals.push($(this).val()); <?php $ids ?> = allvals; }); // testing here in alert! alert(<?=$ids?>); } $(function() { $('#c_b input').click(updatesession); updatesession(); });
};
many thanx in advance!
you can't this. php executes on server before java script runs. can use php build dynamic javascript, can't update php variables javascript directly... pass values javascript server can via ajax or query string
Comments
Post a Comment