Ext.Ajax.request sending OPTIONS request cross-domain when jQuery.ajax sends GET Ext.Ajax.request sending OPTIONS request cross-domain when jQuery.ajax sends GET ajax ajax

Ext.Ajax.request sending OPTIONS request cross-domain when jQuery.ajax sends GET


In the Ext.Ajax.request config, set useDefaultXhrHeader to false. This will prevent the extra OPTIONS request.

According to the docs:

Set this to false to not send the default Xhr header (X-Requested-With) with every request. This should be set to false when making CORS (cross-domain) requests.

My experience is that the OPTIONS call disappeared, I got the POST verb I expected.


Set

Ext.Ajax.useDefaultXhrHeader = false

Before

    Ext.Ajax.request({        url: 'www.yourUrl.com',        .....    });


Or you can set with method like this :

Ext.Ajax.setUseDefaultXhrHeader(false);Ext.Ajax.request({                    url: "http://yoururl.domain",                    success: function(response, eOpt) {                        console.log('success');                    },                    failure: function(response, eOpt) {                        console.log('error');                    }                });