weixin_33691700 2017-05-27 21:55 采纳率: 0%
浏览 14

在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.

  • 写回答

5条回答 默认 最新

  • weixin_33713350 2017-05-27 21:56
    关注

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

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

报告相同问题?