jQuery ajax success error

后端 未结 3 1607
闹比i
闹比i 2021-02-19 03:02

I\'m trying to submit a form witch sends an email:

JS

var that = $(this);
$.ajax({
  url: \'../wp-content/themes/bsj/php/validate.php\',         


        
3条回答
  •  生来不讨喜
    2021-02-19 03:04

    I had the same problem;

    textStatus = 'error'
    errorThrown = (empty)
    xhr.status = 0
    

    That fits my problem exactly. It turns out that when I was loading the HTML-page from my own computer this problem existed, but when I loaded the HTML-page from my webserver it went alright. Then I tried to upload it to another domain, and again the same error occoured. Seems to be a cross-domain problem. (in my case at least)

    I have tried calling it this way also:

    var request = $.ajax({
    url: "http://crossdomain.url.net/somefile.php", dataType: "text",
    crossDomain: true,
    xhrFields: {
    withCredentials: true
    }
    });
    

    but without success.

    This post solved it for me: jQuery AJAX cross domain

提交回复
热议问题