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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -