Reverse Cross Domain POST Requests That Use Ext.Ajax.request

I am working with a script that seems to be using Ext.Ajax.request(with ExtJS 3) to send cross-domain requests - some of them are POST requests. Measures are being taken to move away from ExtJS3 (perhaps to move away from ExtJS in general), but a quick attempt to use XMLHttpRequestdid not work; How can I find out which method is used to send these cross-domain requests?

+5
source share
4 answers

I am currently using ExtJS 3.3.1, I have not made the switch to 4 yet, but most likely when a new project will appear. Despite the source of Ext, I can tell you that they use JSONP to accomplish this task, this is the only way to make an AJAX cross-domain, because JavaScript must obey policies of the same origin .

Are you trying to execute a pure JS implementation of JSONP? Or are you already using the JS library?

Edit

According to our comments ... they make POST requests. This is not possible with JSONP. As far as I can tell, they use tricks iframe. This is the same trick used to download AJAX files in older browsers.

This link explains this in more detail.

, (iframe to, POST, upload file) Valum. ExtJS.

+3

- JS 3.4 Ext.Ajax, , Ext.Ajax.request. , , Ext JS Ext.data.ScriptTagProxy proxy, . , .

var myJsonStore = new Ext.data.JsonStore
({
    autoLoad : true,
    proxy : new Ext.data.ScriptTagProxy
    ({
        url : 'http://www.cross-domain.com/file.php'
    }),
    fields : ['myIdColumn','myCharColumn','myDateColumn']
});

Ext JS, , ACD (AJAX Cross Domain).

0

JSONP - , .

CORS, . CORS (Access-Control-Allow-Origin) -: http://enable-cors.org/

IE 8+ ( caveat, natch), Firefox WebKit. IE : IE (XDomainRequest) CORS. Opera, JSONP polyfill (- https://github.com/gimite/web-socket-js/, Flash).

, , CORS.

0

jsonp Jquery:

$.ajax({
  url: "test.php",
  dataType: "jsonp"
  success: function(data){
     console.log(data)
  }
});

Or, if you have access to the requested content, you can set the Access-Control-Allow-Origin header. PHP example:

header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
-2
source

All Articles