weixin_33735077 2017-04-27 04:46 采纳率: 0%
浏览 165

Ajax缺少参数

I m posting an array along with a variable in ajax like

$.post(pageURL,{data:data,id:linkid},function showData(Data)
{

})

at pageURL the data object is accessible but the id is missing . I tried pushing that id in data array like

data['id']=linkid

but still i cant manage to get that id at pageURL (though i can see that "id" posted in my call header). On pageURL i am trying to get values using print_r($_REQUEST['data']['id']);

my request headers are enter image description here

  • 写回答

4条回答 默认 最新

  • 衫裤跑路 2017-04-27 04:54
    关注

    You should add id in your data object. like this

     data['id']=linkid
    

    Then post it in ajax request.

     $.post(pageURL, { data: data }, function showData(Data) {
    
           });
    

    Then you will be able to access it using data object.

    $_REQUEST[data[id]]'
    

    Complete code.

     data.id = linkid;
           $.post(pageURL, { data: data }, function showData(Data) {
    
           })
    
    评论

报告相同问题?