I''m having a problem with multiple Ajax.Updater instances. I have five small chunks of data being loaded into my homepage, and they seem to be firing off one at a time. So the pieces load up in the order they were called. Maybe I''m being a noob, but shouldn''t all those requests just fire away and then place the content as it gets received? I was doing multiple versions, but I finally ended up simplifying to something like: var call1 = new Ajax.Updater( ''id1'', ''/foo1.html'', { method: ''post'' }); var call2 = new Ajax.Updater( ''id2'', ''/foo2.html'', { method: ''post'' }); etc... Using firebug, I can see all the requests seem to get made simultaneously, but the chunks are received in order. Since each one takes about 3 seconds to process, it makes for a long wait. To make things worse, in IE a link won''t work until all the updaters are complete. So you click the link, wait for everything to load (15 seconds) and only then does the page redirect. Is this something that has more to do with limitations of the HTTP protocol than the XMLHttpRequest object? Thanks! Jason
var call1 = new Ajax.Updater( ''id1'', ''/foo1.html'', { method: ''post'' }); var call2 = new Ajax.Updater( ''id2'', ''/foo2.html'', { method: ''post'' }); Looks like there''s no parameters. Would method: ''get'' perform any better? 3 seconds? Is there a network problem or a large chunk of data? Sam
I tried using ''get'' as well, and it doesn''t seem to make a difference. The actually come on the database end right, as it crunches through a many millions of records, which is why I wanted to make these requests through ajax. I was hoping to keep the page from slowing down by making these as separate requests, allowing people to do other things if they didn''t have a need for the data. On 6/20/06, Sam <sam.google-Uc2IQQBAS6sAvxtiuMwx3w@public.gmane.org> wrote:> var call1 = new Ajax.Updater( > ''id1'', > ''/foo1.html'', > { > method: ''post'' > }); > > var call2 = new Ajax.Updater( > ''id2'', > ''/foo2.html'', > { > method: ''post'' > }); > > Looks like there''s no parameters. Would method: ''get'' perform any better? > > 3 seconds? Is there a network problem or a large chunk of data? > > Sam > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Ack. Sorry, I figured it out. My environment was set in a development mode that limits requests. *bonks self* Sorry for wasting peoples time. On 6/20/06, Jason Hummel <jhummel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I tried using ''get'' as well, and it doesn''t seem to make a difference. > The actually come on the database end right, as it crunches through a > many millions of records, which is why I wanted to make these requests > through ajax. I was hoping to keep the page from slowing down by > making these as separate requests, allowing people to do other things > if they didn''t have a need for the data. > > On 6/20/06, Sam <sam.google-Uc2IQQBAS6sAvxtiuMwx3w@public.gmane.org> wrote: > > var call1 = new Ajax.Updater( > > ''id1'', > > ''/foo1.html'', > > { > > method: ''post'' > > }); > > > > var call2 = new Ajax.Updater( > > ''id2'', > > ''/foo2.html'', > > { > > method: ''post'' > > }); > > > > Looks like there''s no parameters. Would method: ''get'' perform any better? > > > > 3 seconds? Is there a network problem or a large chunk of data? > > > > Sam > > > > > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
i am not sure, but aren''t you missing the option "asynchronous: true" here? how about this? var myFiles = new Array( "/foo1.html'''', "/foo2.html" ); // create some container getElementsByTagName(''body'')[0].appendChild(Builder.node (''div'',{id:''ajaxTest''})); // go thru our array for(var fileNum = 0; fileNum < myFiles.length; fileNum++) { // make up a receiver div $(''ajaxTest'').appendChild(Builder.node(''div'', {id:''myDiv''+fileNum,className:''ajaxResult'')); // do the call and put content in there new Ajax.Updater(''myDiv''+fileNum, myFiles[fileNum] , { asynchronous: true, evalScripts: false }); } works perfect for me.. I just wrote this right in this little mail-window, so the Builder stuff is untested. I hope this approach works for you. regards, Kjell On 6/20/06, Sam <sam.google-Uc2IQQBAS6sAvxtiuMwx3w@public.gmane.org> wrote:> > var call1 = new Ajax.Updater( > ''id1'', > ''/foo1.html'', > { > method: ''post'' > }); > > var call2 = new Ajax.Updater( > ''id2'', > ''/foo2.html'', > { > method: ''post'' > }); > > Looks like there''s no parameters. Would method: ''get'' perform any better? > > 3 seconds? Is there a network problem or a large chunk of data? > > Sam > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
oh well... On 6/20/06, Jason Hummel <jhummel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Ack. Sorry, I figured it out. My environment was set in a development > mode that limits requests. *bonks self* Sorry for wasting peoples > time. > > On 6/20/06, Jason Hummel <jhummel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I tried using ''get'' as well, and it doesn''t seem to make a difference. > > The actually come on the database end right, as it crunches through a > > many millions of records, which is why I wanted to make these requests > > through ajax. I was hoping to keep the page from slowing down by > > making these as separate requests, allowing people to do other things > > if they didn''t have a need for the data. > > > > On 6/20/06, Sam <sam.google-Uc2IQQBAS6sAvxtiuMwx3w@public.gmane.org> wrote: > > > var call1 = new Ajax.Updater( > > > ''id1'', > > > ''/foo1.html'', > > > { > > > method: ''post'' > > > }); > > > > > > var call2 = new Ajax.Updater( > > > ''id2'', > > > ''/foo2.html'', > > > { > > > method: ''post'' > > > }); > > > > > > Looks like there''s no parameters. Would method: ''get'' perform any > better? > > > > > > 3 seconds? Is there a network problem or a large chunk of data? > > > > > > Sam > > > > > > > > > > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs