Hi group, I tried to bring the Prototype''s Ajax functionality to work as described in the tutorial. Here''s the code I used: http://dpaste.com/hold/5093/ Unfortunately, nothing happens. Firebug does not show a request and absolutely nothing happens. I can''t find anything I did wrong, but it seems as if there is a major mistake somewhere. Tested on Safari and Firefox. Regards, -Justin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
hey justin, a quick glance at your code was enough.> new Ajax.Request(''http://www.google.de'', ...I assume that you are not working for google and are not changing their live search just to play around with ajax. so your code must be on some private domain of yours. this is where you''ve made the mistake. for security reasons ajax call can only be made to the same domain the script is calling from. all other attempts will not be fired. cheers /christian --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey Justin, AJAX can only access contents from its originating domain (at least in most browsers), due to what is called the SOP (Same Origin Policy). You can''t access Google.de from anywhere but Google.de, and so forth. This also means it won''t work on a page accessed as a regular file (file://...), you''ll have to go HTTP. Just add this as the first line of your script, you''ll see: Ajax.Responders.register({ onException: function(r, e) { alert(e) }}); You''ll get an error message displayed when Ajax.Request tries to open the XHR connection. What most developers do to circumvent this is implement a "proxy" URL on their originating domain, which simply forwards the call internally, and return the exact HTTP response (headers and body). I believe IE had no such limitation, but apparently your code doesn''t work in there either... Maybe that''s because you loaded it from a regular file:// URL? -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks a lot, it works now. :) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Woah, that saved my day. And additionally, that the json-lib from json.org seems to break everything. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I ran into the same issue and wrote a little script that handles the json serialization and ajax request all in one, basically you just pass it your json object and it returns the response object, already serialized. if that sounds like something you could use, have a look: http://blog.greghinch.com/2007/01/jsontransmit-for-prototype/ On Jan 29, 4:13 am, "bayerj" <bay...-xrfDFxQfymSzQB+pC5nmwQ@public.gmane.org> wrote:> Woah, that saved my day. And additionally, that thejson-lib fromjson.org seems to break everything. > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---