post selextbox values to php page in jquery
- by JPro
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