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

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) {
    
           })
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度