Sencha ExtJS. Unable to send POST request to cross domain with Ext.Ajax.request

I have a backend with a POST function (so JSONP does not work). Backend sends Access-Control-Allow-Origin: * correctly (jQuery.ajax works successfully). But I can not send a request using Ext.Ajax.request

 Ext.Ajax.request({ url: 'http://myurl', method: 'POST', cors: true, success: function () { alert('success'); }, failure: function () { alert('failure'); } }); 

In the debug console, I see the OPTIONS method

enter image description here

Where is my mistake?

 Ext.getVersion() 

version: "5.0.1.1255"

+5
source share
1 answer

I think you will need to set useDefaultXhrHeader to false also in your ajax request, as shown below.

 Ext.Ajax.request({ url: 'http://myurl', method: 'POST', cors: true, useDefaultXhrHeader : false, success: function () { alert('success'); }, failure: function () { alert('failure'); } }); 
+8
source

Source: https://habr.com/ru/post/1210023/


All Articles