Results 1 to 10 of 10

Thread: Using Ext.Ajax.request for a file on another website

  1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    158
    Vote Rating
    10
      0  

    Default 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.

    Code:
    Ext.Ajax.request({
         url:"https://twitter.com/goodies/list_of_lists?screen_name=zgardnerallofe",
         callback:function(inOptions, inSuccess, inResponse) {
              debugger;
         }
    });
    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?

    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.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    It's just that loading something from another domain has more coding. You have to use a proxy like ScriptTagProxy
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Ext User
    Join Date
    Aug 2009
    Posts
    588
    Vote Rating
    1
      0  

    Default

    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.

  4. #4
    Ext User
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default

    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.

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,584
    Vote Rating
    873
      0  

    Default

    Do a google search for cross domain policy.
    Evan Trimboli
    Twitter - @evantrimboli

  6. #6
    Ext User
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default

    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.

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,584
    Vote Rating
    873
      0  

    Default

    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
    Twitter - @evantrimboli

  8. #8
    Ext User
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default

    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

  9. #9
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,584
    Vote Rating
    873
      0  

    Default

    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
    Twitter - @evantrimboli

  10. #10
    Ext User
    Join Date
    Feb 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default

    hmmm...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •