JQuery AJAX Request 302 Redirect - What callbacks are available?

I am working with an older system using jQuery 1.2.6. I am sending an AJAX request through a function jQuery.ajax. The URL that he clicks sends a 302 HTTP Redirect response and ultimately receives a 200 HTTP OK response. I registered a callback successand complete, but none of them are called.

My question is: are there any callbacks that can / will be called after the redirect?

jQuery.ajax({
    type: "GET",
    url: url,
    data: null,
    dataType: "json",
    async: false,
    success: function(data, textStatus) {
        alert("SUCCESS CALLED: " + textStatus);
    },      
    complete: function(xhr, status) {
        alert("COMPLETE CALLED");
    }
});

NOTE. The answer is HTML, not JSON, however changing dataTypeto htmlchanges the request. It sends a request OPTIONSinstead of a request GET, and it also no longer redirects. I need these redirects.

+3
source
2

:

dataType html . OPTIONS GET, .

, crossdomain. I.e., url , , script . . , , . HTTP OPTIONS , jQuery, Allow , URL-, jQuery . , -, .

, - , URL- . jQuery url, URL- . , , , Java, java.net.URLConnection Apache HttpComponents Client .

+2

jquery ajax

dataType: 'jsonp'

. ( FF/Chrome)

, --url jsonp-.

0

All Articles