jQuery-XMPP-plugin icon indicating copy to clipboard operation
jQuery-XMPP-plugin copied to clipboard

IE XDR Support breaks jQuery AJAX calls with custom dataTypes

Open mithusree opened this issue 11 years ago • 1 comments

$.ajaxTransport code added in the plugin support Microsoft XDR Support #18 is causing problems with $.ajax with custom ajax return data types like JSON.

For eg;

Whenever jquery.xmpp.js is included,

$.ajax({
        url: 'api.php',
        type: "POST",
        cache : false,
        dataType: "json",
        data : {
            username : "aaa",
            password : "bbb"
        },
        success : function(response) {
            console.log("AJAX Success");
            console.log(response);
        },
        error : function(jqXHR, textStatus, errorThrown) {
            console.log("AJAX Error");
            console.log(jqXHR);
            console.log("Status code: " +jqXHR.status);
            console.log(textStatus);
            console.log(errorThrown);
        }
    });

error call back is always executed, and the jqXHR.status will be 400 even if server responds with

header('HTTP/1.1 200 OK');

Better XDR support script can be found here https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest

mithusree avatar Oct 28 '13 10:10 mithusree

Thank you, I will try to see how to fix

maxpowel avatar Jan 13 '14 17:01 maxpowel