I have the following code and it seems to be not sending any params with the request. Any ideas what could be the issue? This is just a part of the code and I have ensured the variables x, y and pos in the params are being received:
const params = {
lat: x,
long: y,
current:pos,
};
var xhttp =new XMLHttpRequest();
xhttp.open("POST","http://example.com/test/",true);
xhttp.setRequestHeader("X-CSRFToken", csrftoken);
xhttp.send(JSON.stringify(params));
location.reload(true);
The POST request gets received on the server but there's no params