post selextbox values to php page in jquery
Posted
by JPro
on Stack Overflow
See other posts from Stack Overflow
or by JPro
Published on 2010-06-16T16:00:45Z
Indexed on
2010/06/16
16:02 UTC
Read the original article
Hit count: 151
I am using jquery button click to post all the values in a selectbox to a PHP page, but this code does not seem to work. Can anyone please help?
<script type="text/javascript">
$(function() {
$("#btn1").click(function () {
var arr= new Array;
$("#target_select option").each (function () {
// You can push the array on an array
arr.push( $(this).val() );
//alert( $(this).val() ); not getting the alert to display too
});
$.post("test.php", { name: arr } );
});
});
</script>
Generate
© Stack Overflow or respective owner