Andrei RRR
Andrei RRR

Reputation: 3162

Ext.Ajax.request : External URL not working?

I have this code to replace an ID for a SenchaTouch Web App:

function showRates() {
    Ext.Ajax.request({
        url: 'http://www.google.com',
        success: function(response, opts) {
            Ext.getCmp('card1').update(response.responseText);
        }
    });
};

and it works if I change the url to a local file like "ajax.html" for example. Any idea about how can I fix this?

Upvotes: 0

Views: 1491

Answers (2)

Nilanchala
Nilanchala

Reputation: 5941

Cross domain Ajax calls from JavaScript are not supported by Chrome/Safari browsers. If, you are working for mobile development, try packaging the application with all your source into the WWW/asserts folder and build using Phone gap. It will certainly work.

Hope u getting me. Visit the below links for clear picture.

cross-domain-ajax-requests-sencha-touch-bits

Cross-domain-Ext.Ajax-Ext.data.Connection

Upvotes: 0

Evan Trimboli
Evan Trimboli

Reputation: 30092

See: http://en.wikipedia.org/wiki/Same_origin_policy

You'll want to use JSONP to get content from external servers.

Upvotes: 2

Related Questions