chuanjie
chuanjie
  • 发布:2014-11-18 16:48
  • 更新:2019-12-06 23:40
  • 阅读:1496

xmlhttprequest我用的post方法提交,但是我的php端没有$_post的值

分类:HBuilder

xmlhttprequest我用的post方法提交,但是我的php端没有$_post的值
我的代码这么写的,麻烦帮忙看看是什么问题

<script>

var xhr=null;  
function senddata(obj){  
var data='username='+obj.username.value+'&password='+obj.pwd.value;  

xhr=new plus.net.XMLHttpRequest();  
xhr.onreadystatechange=xhrStatechange;  
var url="user_api.php?act=act_login";  
xhr.setRequestHeader('Content-Type','application/text');  
xhr.open( "POST", url );  
xhr.send(data);  
return false;  
}
2014-11-18 16:48 负责人:无 分享
已邀请:
bianyuan456

bianyuan456

send之前加上
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

该问题目前已经被锁定, 无法添加新回复