在ajax中发送$ _POST数据

First of all , thanks for your interest, well let me explain. I want to get $_POST['Division'] from and dropdown list :

`

<select name="Division" onchange="setImage2(this);">
   <option value="1">Bronze</option>
   <option value="2">Silver</option>
   <option value="3">Gold</option>
   <option value="4">Platinum</option>
   <option value="5">Diamond</option>
</select>

`

And I try to send this like so :

$.ajax({
  url: 'test_fnc.php',
  type: 'post',
  data: { "callFunc1": $_POST['Division'], "callFunc1A": "1"},
  success: function(response) { alert(response); }
});

But it's not working , can I request your help ? Thanks alot ! Regards.

This is php code, so you can make it work like this:

data: { "callFunc1": <?php echo $_POST['Division']; ?>, "callFunc1A": "1"}

You should use jQuery browser-side:

$.ajax({
  url: 'test_fnc.php',
  type: 'post',
  data: { "callFunc1": $('[name=Division]').val(), "callFunc1A": "1"},
  success: function(response) { alert(response); }
});

So to close my subject, here is the solution :

 $.ajax({
      url: 'test_fnc.php',
      type: 'post',
      data: { "callFunc1": select.options[select.selectedIndex].value, "callFunc1A": "1"},
      success: function(response) { alert(response); }
  });

use this insted.

 var sel = document.getElementsByName("Division")[0];
 var callFunc1_var= sel.options[sel.selectedIndex].value;
 your ajax code...
 data: { "callFunc1": callFunc1_var, "callFunc1A": "1"},
 your ajax code..

1) you must replace $_POST['Division'] in $.ajax to $('#Division > option:selected').val()

2) you must replace <select name="Division"> in html to <select id="Division">