Hi, i am trying to call AJAX with domain address different than mine. but i get an exception: permission denied to call method XMLHTTPRequest.open What''s the solution? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You can''t. XMLHttpRequest cannot go across domains. There is a W3C recommendation on the table to provide this capability (server-side config will be necessary). http://www.w3.org/TR/access-control/ You can also use JavaScript/JSON with dynamic script tags to accomplish cross-site requests, but it''s a more limited scenario. You can find some resources by googling for ajax dynamic script tag. -Fred On Tue, Jul 1, 2008 at 6:13 AM, odelya <be.special-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > i am trying to call AJAX with domain address different than mine. > but i get an exception: > permission denied to call method XMLHTTPRequest.open > > What''s the solution?-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You could not request ajax to different domain. This rule named SOP (Same Origin Policy), and it was mentioned in manual like this: "/remember that XHR is usually used on URLs from the same host that originated the current page (this is the famous Same Origin Policy, or SOP)/". There are some solutions. You could request to file at your own domain, and this file will request to content at target domain. Or, with JSONP. odelya wrote:> Hi, > > i am trying to call AJAX with domain address different than mine. > but i get an exception: > permission denied to call method XMLHTTPRequest.open >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---