weixin_33691817 2011-06-24 04:20 采纳率: 0%
浏览 31

Java上的Json错误

I need some help finding out what's wrong in this code:

ajaxRequest.open("POST", "http://localhost:8181/add", true)
ajaxRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
ajaxRequest.send(data);

I'm trying to send data to the server using POST, and ajaxRequest is an ajaxRequestElement().

The problem is when I open the page, the console provided by Chrome to detect Javascript errors says POST http://localhost:8181/add undefined (undefined).

I know the URL is correct and the page receiving the data is ok too, I tried this before in PHP and works fine, so I don't understand what's happening.

  • 写回答

1条回答 默认 最新

  • weixin_33711647 2011-06-24 04:26
    关注

    It could be that you are posting to http://localhost/add instead of http://localhost:8181/add. Could you simply use 'add' as the url to post your ajax request to?

    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作