2016-05-30 39 views
0

我已经尝试了很多,但不能使POST通过XMLHttpRequest的 发送此它的代码POST的XmlHttpRequest不行

var xhr = new XMLHttpRequest(); 
var params="device=android&device_token="+Notifications.remote.token" 
xhr.open("POST", "https://xxx.xxx.it/test.php",true); 
xhr.setRequestHeader("Access_Token", "11bdf06b9fda0639b300c023cb0b3ba5"); 
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 
xhr.setRequestHeader("Content-length", params.length); 
xhr.send(params); 

页被称为,但没有被传递..没有ACCESS_TOKEN并没有POST值

回答

0

如果您使用的是桌面版本,则不能这样做。您必须使用WebClient类,因为Smartface已更新到Cloud并将其删除(或至少隐藏了它),所以我找不到桌面文档,对不起。但是Stack Overflow还有另一个问题,我解释了如何将Firebase与Smartface一起使用,为了更好的理解,我建议阅读它。
How to create a webservice for a login system?

希望有帮助! :)