-
25 Jan 2010 7:59 AM #1
Using Ext.Ajax.request for a file on another website
Using Ext.Ajax.request for a file on another website
I want to retrieve some data from another site and use it locally, but when I specify the url parameter of Ext.Ajax.request, the request is never issued.
When I look at firebug, it looks like the request was never issued. Is there some other variable that I need to turn on or something, or was this done by design?Code:Ext.Ajax.request({ url:"https://twitter.com/goodies/list_of_lists?screen_name=zgardnerallofe", callback:function(inOptions, inSuccess, inResponse) { debugger; } });
The easy way to get around it was to have it load from a local PHP file which did a file_get_contents of the URL, but this seems like unnecessary overhead when JS could do it directly.
-
25 Jan 2010 8:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
It's just that loading something from another domain has more coding. You have to use a proxy like ScriptTagProxy
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
25 Jan 2010 9:27 AM #3
Browsers generally will not load material from more than one site at a time. (This is an erstwhile "security" feature, of dubious merit IMHO.) But you can easily arrange for a server to obtain the material by those means, and "relay" it to the client.
-
2 Feb 2010 10:51 PM #4
Hi, I want to make http ajax request to other server, url works fine inany browser and returns status as "400" with output. But if I make ajax request to the same gives me communication failure message and in firebug the request status shows as "404" bad request. has anyone come across such situation and got the solution? please do let me know.
thanks.
-
2 Feb 2010 11:23 PM #5
Do a google search for cross domain policy.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
2 Feb 2010 11:49 PM #6
Thanks for reply. I know about cross domain policy. But here question is not about the policies. I want to display the results by making ajax calls to other server without any server side code and of course without any policy file.
-
3 Feb 2010 12:06 AM #7
That's the point. If you read the stuff about cross domain policy, you would know it's not possible, it's a security restriction imposed by the browser.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
3 Feb 2010 12:08 AM #8
Hi, Actually I was going through similar posts and found this http://www.extjs.com/forum/showthread.php?t=17691
I have not tried the example.
Thanks
-
3 Feb 2010 12:18 AM #9
Yes, but like the ScriptTagProxy it requires the data from the server to wrapped in a JS method that can be executed. Unless Twitter happens to have an API that sends data in that format, you can't do it.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
3 Feb 2010 12:20 AM #10


Reply With Quote