POST XmlHttpRequest not work

38 Views Asked by At

I have tried a lot but cannot make POST send through XMLHttpRequest this it the code

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);

Page is called but nothing is passed.. no Access_Token and no POST values

1

There are 1 best solutions below

0
Luccas Clezar On

If you are using the Desktop version, you can't do this way. You have to use WebClient class, I couldn't find the desktop documentation because Smartface has updated to Cloud and deleted it (or at least hidden it), sorry. But there's another question on Stack Overflow that I explain how to use Firebase with Smartface, I recommend reading it for better understanding.
How to create a webservice for a login system?

Hope that helps! :)