ajax传值给php文件问题

木偶人 2016-12-27 10:41:27

var concrete = document.getElementById("s6").value;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange =function(){
if(xhr.readyState == 4){
if(xhr.responseText!=false){
//document.getElementById("newaddress").className="hide";
//alert(xhr.responseText);
document.getElementById("introduce").innerHTML=xhr.responseText;
}
}
}
xhr.open('post',test+"/newaddress");
xhr.send(concrete);


路径是正确的是http://localhost:8080/mooc/shop/index.php/home/Order/newaddress
怎么在php文件接收不到值啊???
求大神解答
...全文
117 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuzuning 2016-12-28
  • 打赏
  • 举报
回复
因为缺少了 xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧