Pat Maddox
2007-Apr-25 23:23 UTC
Creating an Ajax.Updater - do I have to start the request?
I realize this is a Prototype question, but I figure somebody here knows the answer. I want to make a simple HTTP request using Javascript and spit the results out onto my page. So I made an Ajax.Updater like this: new Ajax.Updater("view_frame", "http://localhost:3000", {asynchronous:false, evalScripts:true, method:''get''}); I''ve got a div whose id is view_frame, so I *think* that this should make a request and then update view_frame''s innerHTML to whatever the webserver renders. However looking at the logs no request is made at all. No Javascript errors. What do I need to do in order to make the request happen? Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
MichaelLatta
2007-Apr-25 23:50 UTC
Re: Creating an Ajax.Updater - do I have to start the request?
Your javascript looks fine except you need to provide the full path to the action you want executed. http://localhost:3000/controller/action If the action is an RJS template then you may not need to specify view_frame as the target just use {} instead. If it is an rhtml template then all you need is to tell it what action to invoke. You do not need to start the action, it will make the request itself as part of the object creation with "new". Michael On Apr 25, 4:23 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I realize this is a Prototype question, but I figure somebody here > knows the answer. > > I want to make a simple HTTP request using Javascript and spit the > results out onto my page. So I made an Ajax.Updater like this: > > new Ajax.Updater("view_frame", "http://localhost:3000", > {asynchronous:false, evalScripts:true, method:''get''}); > > I''ve got a div whose id is view_frame, so I *think* that this should > make a request and then update view_frame''s innerHTML to whatever the > webserver renders. However looking at the logs no request is made at > all. No Javascript errors. What do I need to do in order to make the > request happen? > > Pat--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pat Maddox
2007-Apr-26 00:32 UTC
Re: Creating an Ajax.Updater - do I have to start the request?
On 4/25/07, MichaelLatta <lattam-ee4meeAH724@public.gmane.org> wrote:> > Your javascript looks fine except you need to provide the full path to > the action you want executed.http://localhost:3000/ is where I want the call to do. Basically I want the same behavior as an iframe...but I want to embed the HTML directly into the page rather than using an iframe. I thought that''s what this Updater is supposed to do - make an HTTP request and update some div with the results. Why is it not even making the request? Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pat Maddox
2007-Apr-26 01:47 UTC
Re: Creating an Ajax.Updater - do I have to start the request?
On 4/25/07, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4/25/07, MichaelLatta <lattam-ee4meeAH724@public.gmane.org> wrote: > > > > Your javascript looks fine except you need to provide the full path to > > the action you want executed. > > http://localhost:3000/ is where I want the call to do. Basically I > want the same behavior as an iframe...but I want to embed the HTML > directly into the page rather than using an iframe. I thought that''s > what this Updater is supposed to do - make an HTTP request and update > some div with the results. Why is it not even making the request?I was reading the HTML file off my desktop, and using it to fetch a page from the Rails server. When I served up the HTML file from mongrel, it did it fine. It would have been nice if Updater had given an error instead of just not responding... So is it possible at all to do what I want? I need the HTTP request go to a different domain than the web page being served up. Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---