ajax - XHR readyState = 4 but Status = 0 in Google Chrome Browser -


Hello, I have a strange problem with an AJAX call on my site. I call a simple AJAX call on a script on my site. But AJAX call fails in place = 4 and position = 0. There is no cross domain problem because the script I want to call is on my server.

  $ Ajax ({type: "GET", Url: 'http://mydomain.com/test.php', success: function (feedback) {console.log (response);}, error: function (XHR) {console. Log (logic);}});  

I have run many sites but there is no solution for this!

This happens when the AJAX request URL has a different domain than the page script is running. For example, www.mydomain.com and mydomain .com are different.

To fix this, replace

  url: 'http://mydomain.com/test.php',  
url: 'http: //' with document.domain + '/test.php',

I got an answer to this question when I myself saw the answer to the answer. I got the solution.


Comments