var url = "your_url";
xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type", "application/json");
xhr.onreadystatechange = function ()
{
if (xhr.readyState == 4 && xhr.status == 200) {
//do whatever you want to do
} else {
//do whatever you want to do
}
}
xhr.send(JSON.stringify({
"key_1": "value_1",
"key_2": "value_2"
}));
Надеюсь, это поможет вам.