weixin_33725807 2016-01-29 11:37 采纳率: 0%
浏览 25

php jQuery动态下拉列表

I am having problem sending/reading ajax variable.

Ajax code is as below:

$.ajax({
    url: "/wp-content/themes/canvas-child/get-clients-dropdown.php?it=1",
    success: function(data) {
        $("#ClientID").html(data);
    }
});

I have tried to read it in another php file like this:

$InvoiceType = $_REQUEST['it'];
//$InvoiceType = $_POST['it'];
//$InvoiceType = $_GET['it'];

But none of above works. The variable $InvoiceType always stays empty.

What is the problem?

  • 写回答

4条回答 默认 最新

  • weixin_33736832 2016-01-29 11:45
    关注
    $.ajax({
          type: "GET",
          data: {it: "1"}, 
          url: "/wp-content/themes/canvas-child/get-clients-dropdown.php?it=1",
          success: function(data) {
             $("#ClientID").html(data);
          }
    });
    

    try this

    评论

报告相同问题?