I send the 1st request to the server, I get a response. I send the 2nd, the response from the server is different, I looked through Charles, but the answer is displayed from the 1st request, what should I do? (The problem occurs in Chrome)

var response31 = new XMLHttpRequest(); response31.onload = function() { alert(this.responseText); var response3 = new XMLHttpRequest(); response3.onload = function() { alert(this.responseText); } response3.onerror = function() { stopper(); } response3.open('POST', protocol + '....', true); response3.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') response3.send('....'); } response31.onerror = function() { stopper(); } response31.open('POST', protocol + '....', true); response31.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') response31.send('.....'); 
  • You want to say that the answer of the 1st request is displayed twice? Or that only the 1st response is displayed and the 2nd is not displayed despite the fact that both of them came? - Duck Learns to Take Cover
  • @MakarovAV Both that and that requests pass, but also there and there the answer of the 1st request is output. Although, if you catch the answers, they are different - Vlmake
  • so stop, you consistently work with them or one in the handler of the other? And then the code is changing, it is not clear) - Duck Learns to Hide
  • @MakarovAV One in the handler of the other - Vlmake
  • try to call in response3.onload not through this but through response3.responseText - Duck Learns to Hide

0