Notice that their example has '/proxy?url=' in front of the url they are requesting. That's how they're getting around the cross-site limitation. The proxy would be an accessible page on their web server.
Thomas Woodham Data Editor - The Greenville News 864.298.4302 [BECAUSE THE NEWS NEVER STOPS] -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of polomasta Sent: Monday, December 03, 2007 12:24 PM To: Ruby on Rails: Spinoffs Subject: [Rails-spinoffs] Re: Ajax.PeriodicalUpdater this is from the basic example on protoype website (http:// www.prototypejs.org/api/ajax/request) var url = '/proxy?url=' + encodeURIComponent('http://www.google.com/ search?q=Prototype'); // notice the use of a proxy to circumvent the Same Origin Policy. So I am guessing there is some way to make it worth with the gadget... just not sure how. as a side note... when I upload everything to my server and test it, it runs fine if my url is a .xml file. If i try to reference the .php that generates xml output... my response.Text is blank On Dec 3, 11:07 am, "Woodham, Thomas" <[EMAIL PROTECTED]> wrote: > > var url = 'http://www.myurl.com/xmlneeded.php'; > > var ajax = new Ajax.Request(url, { > > The url would violate cross-site scripting limitations built into the > XMLHttpRequest object. Any ajax request has to be on the same domain as the > page making the request. > > Thomas Woodham > Data Editor - The Greenville News > 864.298.4302 > > [BECAUSE THE NEWS NEVER STOPS] > > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of polomasta > Sent: Monday, December 03, 2007 11:49 AM > To: Ruby on Rails: Spinoffs > Subject: [Rails-spinoffs] Re: Ajax.PeriodicalUpdater > > As I read more I noticed this too, so I've switched to Ajax.Request . > However, it keeps failing. Here are some more details as to my project. > > I am creating a windows sidebar gadget that needs to connect to a page on a > remote server that uses php to generate XML content. I then need to parse > through that content to find a specific xml tag, then iterate through the > child elements of that tag, extracting the content from each child node and > place it in a separate div for each child. > > My ajax request keeps failing, and I am guessing this is because the url i'm > requesting is on a remote server (while the gadget is more or less a local > html page). Any ideas on how to work around this and then perform the rest of > what is needed? Below is my code thus far.. > > function init() > { > > var url = 'http://www.myurl.com/xmlneeded.php'; > var ajax = new Ajax.Request(url, { > method: 'get', > onSuccess: updateDisplay, > onFailure: alert("FAILED")}) > } > > var updateDisplay = function(transport) { > var xmlResponse = transport.responseText; > //now i need to find <myParent> in the XML and iterate through > the child nodes to extract info } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
