The following are the contents of my php applications index.php page: <html> <head> <title>Demo</title> <script type="text/javascript" src="http://localhost/demo/ prototype.js"> window.onload=function() { new Ajax.Updater(''div_rss'', ''http://localhost/demo/demo.php'', { method: ''post'' }); } </script> </head> <body> <div id=''div_rss''>Loading contents...</div> </body> </html> This is the demo.php that is called by Ajax.Update <?php echo "New Contents"; ?> Where am I going wrong? Why wont the contents of the div change? 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 -~----------~----~----~----~------~----~------~--~---
there a better way to manage the onload event ;) and all the requests send by post <html> <head> <title>Demo</title> <script type="text/javascript" src="http://localhost/demo/prototype.js "></script> <script type="text/javascript"> Event.observe(window,"load",loadcontent); function loadcontent() { new Ajax.Updater(''div_rss'',''http://localhost/demo/demo.php''); } </script> </head> <body> <div id=''div_rss''>Loading contents...</div> </body> </html> On Dec 17, 2007 4:53 AM, Dsyfa <aiub.cyberX-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The following are the contents of my php applications index.php page: > > <html> > <head> > <title>Demo</title> > > <script type="text/javascript" src="http://localhost/demo/ > prototype.js"> > > window.onload=function() > { > new Ajax.Updater(''div_rss'', > '' > http://localhost/demo/demo.php'', > { method: ''post'' > }); > } > </script> > > </head> > > <body> > <div id=''div_rss''>Loading contents...</div> > </body> > </html> > > This is the demo.php that is called by Ajax.Update > > <?php > > echo "New Contents"; > > ?> > > > Where am I going wrong? Why wont the contents of the div change? > > Thanks > > >-- {a human being that was given to fly} --~--~---------~--~----~------------~-------~--~----~ 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''re writing to the DIV before the browser builds the HTML. You can fiddle with changing the onload, or you can put the Ajax call in a function, then call that funtion from the bottom of the page, ensuring the HTML (which is above your function all) has been rendered to the page. On Dec 17, 5:53 am, Dsyfa <aiub.cyb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The following are the contents of my php applications index.php page: > > <html> > <head> > <title>Demo</title> > > <script type="text/javascript" src="http://localhost/demo/ > prototype.js"> > > window.onload=function() > { > new Ajax.Updater(''div_rss'', > ''http://localhost/demo/demo.php'', > { method: ''post'' }); > } > </script> > > </head> > > <body> > <div id=''div_rss''>Loading contents...</div> > </body> > </html> > > This is the demo.php that is called by Ajax.Update > > <?php > > echo "New Contents"; > > ?> > > Where am I going wrong? Why wont the contents of the div change? > > 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 -~----------~----~----~----~------~----~------~--~---
<html> <head> <title>Demo</title> <script type="text/javascript" src="prototype.js"></script> <script type="text/javascript"> document.observe("dom:loaded",loadcontent); function loadcontent() { new Ajax.Updater(''div_rss'',''ajax.php''); } </script> </head> <body> <div id=''div_rss''>Loading contents...</div> </body> </html> with the "dom:loaded" you can be sure that the html is rendered or i''m wrong? On Dec 17, 2007 1:54 PM, Diodeus <diodeus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > You''re writing to the DIV before the browser builds the HTML. You can > fiddle with changing the onload, or you can put the Ajax call in a > function, then call that funtion from the bottom of the page, ensuring > the HTML (which is above your function all) has been rendered to the > page. > > On Dec 17, 5:53 am, Dsyfa <aiub.cyb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > The following are the contents of my php applications index.php page: > > > > <html> > > <head> > > <title>Demo</title> > > > > <script type="text/javascript" src="http://localhost/demo/ > > prototype.js"> > > > > window.onload=function() > > { > > new Ajax.Updater(''div_rss'', > > '' > http://localhost/demo/demo.php'', > > { method: > ''post'' }); > > } > > </script> > > > > </head> > > > > <body> > > <div id=''div_rss''>Loading contents...</div> > > </body> > > </html> > > > > This is the demo.php that is called by Ajax.Update > > > > <?php > > > > echo "New Contents"; > > > > ?> > > > > Where am I going wrong? Why wont the contents of the div change? > > > > Thanks > > >-- {a human being that was given to fly} --~--~---------~--~----~------------~-------~--~----~ 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 Elden! It now works like a charm! But your second implementation i.e. by observing the dom:loaded event didn''t work. Anyway, I just want to know one thing. If I make two Ajax.Updater calls, one after the another, will they be processed asynchronously or synchronously? On Dec 17, 8:46 pm, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> there a better way to manage the onload event ;) > > and all the requests send by post > > <html> > <head> > <title>Demo</title> > <script type="text/javascript" src="http://localhost/demo/prototype.js > "></script> > <script type="text/javascript"> > Event.observe(window,"load",loadcontent); > function loadcontent() > { > new Ajax.Updater(''div_rss'',''http://localhost/demo/demo.php''); > } > </script> > </head> > <body> > <div id=''div_rss''>Loading contents...</div> > </body> > </html> > > On Dec 17, 2007 4:53 AM, Dsyfa <aiub.cyb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > The following are the contents of my php applications index.php page: > > > <html> > > <head> > > <title>Demo</title> > > > <script type="text/javascript" src="http://localhost/demo/ > > prototype.js"> > > > window.onload=function() > > { > > new Ajax.Updater(''div_rss'', > > '' > >http://localhost/demo/demo.php'', > > { method: ''post'' > > }); > > } > > </script> > > > </head> > > > <body> > > <div id=''div_rss''>Loading contents...</div> > > </body> > > </html> > > > This is the demo.php that is called by Ajax.Update > > > <?php > > > echo "New Contents"; > > > ?> > > > Where am I going wrong? Why wont the contents of the div change? > > > Thanks > > -- > {a human being that was given to fly}--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
They will proceed asynchronously up to the http current connection maximum (2 in most browsers per [sub]domain) and then more will start as each finish per [sub]domain. Gareth On Dec 18, 2007 6:05 PM, Dsyfa <aiub.cyberX-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks Elden! It now works like a charm! But your second > implementation i.e. by observing the dom:loaded event didn''t work. > Anyway, I just want to know one thing. If I make two Ajax.Updater > calls, one after the another, will they be processed asynchronously or > synchronously? > > On Dec 17, 8:46 pm, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > there a better way to manage the onload event ;) > > > > and all the requests send by post > > > > <html> > > <head> > > <title>Demo</title> > > <script type="text/javascript" src=" > http://localhost/demo/prototype.js > > "></script> > > <script type="text/javascript"> > > Event.observe(window,"load",loadcontent); > > function loadcontent() > > { > > new Ajax.Updater(''div_rss'','' > http://localhost/demo/demo.php'' <http://localhost/demo/demo.php%27>); > > } > > </script> > > </head> > > <body> > > <div id=''div_rss''>Loading contents...</div> > > </body> > > </html> > > > > On Dec 17, 2007 4:53 AM, Dsyfa <aiub.cyb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > The following are the contents of my php applications index.php page: > > > > > <html> > > > <head> > > > <title>Demo</title> > > > > > <script type="text/javascript" src="http://localhost/demo/ > > > prototype.js"> > > > > > window.onload=function() > > > { > > > new Ajax.Updater(''div_rss'', > > > '' > > >http://localhost/demo/demo.php'', > > > { method: > ''post'' > > > }); > > > } > > > </script> > > > > > </head> > > > > > <body> > > > <div id=''div_rss''>Loading contents...</div> > > > </body> > > > </html> > > > > > This is the demo.php that is called by Ajax.Update > > > > > <?php > > > > > echo "New Contents"; > > > > > ?> > > > > > Where am I going wrong? Why wont the contents of the div change? > > > > > Thanks > > > > -- > > {a human being that was given to fly} > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---