开发者

ExtJS Retrieve JSON Data

开发者 https://www.devze.com 2023-01-21 17:00 出处:网络
I understand that it\'s not possible request JSON data from a remote domain due to XSS vulnerabilities:

I understand that it's not possible request JSON data from a remote domain due to XSS vulnerabilities:

    Ext.Ajax.request({
        method: 'GET',
        url: 'remoteurl.php'
    });

So the alternative is to use a ScriptTagProxy and a JSONStore:

   store = new Ext.data.JsonStore({
        autoLoad: true,
        proxy: new Ext.data.ScriptTagProxy({
            url:'remoteurl.php',
             r开发者_如何学运维estful: true
    })
});

The problem is that I can't seen to harness the response at all from this request. Although I can print the data to console (store.reader.jsonData), I can't seem to persist it (probably due to it being asynchronous).

Ideally what I'd like to do is get the XmlHttpResponseText as a JSON object in full from the request - specifying the mappings for the JSONStore is not an option in this scenario as I can't predict what the fields are going to be.

Is there any way, by using the JsonStore, to grab the entire response as an object?

Thanks!


Hm, I can't believe that's possible, the ScriptTagProxy is just really a script tag in the end.

0

精彩评论

暂无评论...
验证码 换一张
取 消