J
J
Jsus Phptos2017-01-05 21:14:14
JavaScript
Jsus Phptos, 2017-01-05 21:14:14

Ajax works only through false how to be?

ajax works only synchronously and asynchronously does not work what am I doing wrong?
var req = new XMLHttpRequest();

req.open('POST','FlieTest17.php',true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req send(body);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Николай Романович, 2017-01-05
@MikalaiR

var req = new XMLHttpRequest();
req.open('POST','FlieTest17.php',true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
req.onreadystatechange = function (aEvt) {
  if (req.readyState == 4) {
     if(req.status == 200)
      {
           // тут обрабатываем ответ
      }
     else
      dump("Error loading page\n");
  }
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question