Здравствуйте, подскажите как использовать этот код
var xhr = new XMLHttpRequest();
var params = {
"input_data": "{\"domains\":[{\"dname\":\"ya.ru\"},{\"dname\":\"yayayayayaya.ru\"},{\"dname\":\"xn--000.com\"},{\"dname\":\"china.cn\"},{\"dname\":\"ййй.me\"},{\"dname\":\"wwww.ww\"},{\"dname\":\"a.ru\"},{\"dname\":\"qqйй.com\"},{\"dname\":\"rr.ru.com\"}]}",
"input_format": "json"
};
var form = {
input_format: "json",
output_format: "json",
io_encoding: "utf8",
input_data: JSON.stringify(params),
show_input_params: 0,
username: "test",
password: "test"
};
xhr.open("POST", "https://api.reg.ru/api/regru2/domain/check");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
alert("Status: "+
this.status+"\nHeaders: "+
JSON.stringify(this.getAllResponseHeaders())+"\nBody: "+this.responseText);
}
};
var postData = [];
for (var key in form) {
if (!form.hasOwnProperty(key)) continue;
postData.push(key + "=" + form[key]);
}
xhr.send(postData.join("&"));