Passing Array Of Checkbox Values to Php Through Jquery Web-development (jquery) Passing Array Of Checkbox Values to Php Through Jquery
Passing array of checkbox values to php through jQuery//index.hmtl <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> function doit() { var p=[]; $('input.cb').each( function() { if($(this).attr('checked')) { p.push($(this).attr('rel')); } } ); $.ajax( { url:'process.php', type:'POST', data: {list:p}, success: function(res) { alert(res); } }); } </script> <input type="checkbox"></input>Test 1<br /> <input type="checkbox"></input>Test 2<br /> <input type="checkbox"></input>Test 3<br /> <a href="javascript:void(0)" onclick="doit()">Click</a>
//process.php <?php print_r(@$_POST['list']); ?>
0 Response to "Passing Array Of Checkbox Values to Php Through Jquery"
Posting Komentar