aspnetguy Posted October 23, 2007 Share Posted October 23, 2007 I need to make a call to some RESTful APIs and would like to avoid using server side code if at all possible.I can easily make the calls using AJAX and PHP's get_file_contents($myurl) but in some cases server side langauges are not available.A sample call would be to http: //twitter.com/statuses/user_timeline/username_goes_here.jsonIf I try a regular AJAX request I get Access Denied as expected because it is outside my applications domain. Is there anyway to trick the browser into thinking it is the same domain or another method to get this web service with only JS? Link to comment Share on other sites More sharing options...
boen_robot Posted October 23, 2007 Share Posted October 23, 2007 No. You may be able to pass the URL to your own PHP file and then from PHP, get to the web service, but this again requires PHP, so... there's no way. Link to comment Share on other sites More sharing options...
aspnetguy Posted October 23, 2007 Author Share Posted October 23, 2007 No. You may be able to pass the URL to your own PHP file and then from PHP, get to the web service, but this again requires PHP, so... there's no way.That is what I am doing now. I am developing a JS wrapper for Twitter and had a feature request for a pure JS method. Didn't think it was possible. Thanks. Link to comment Share on other sites More sharing options...
Synook Posted October 24, 2007 Share Posted October 24, 2007 Lol topic 16000! :)You could use invisible frames and innerHTML... Link to comment Share on other sites More sharing options...
aspnetguy Posted October 25, 2007 Author Share Posted October 25, 2007 I would still get an access denied error if I try to extract the contents of a frame outside my domain. Link to comment Share on other sites More sharing options...
Synook Posted October 25, 2007 Share Posted October 25, 2007 Oh yeah... true... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.