I have this simple code, where onLoading seems to continue
runing after ajax request is done :
new Ajax.Updater(''main'', ''/foo.php'',
{ method: ''get'',
onComplete: function(req) {
alert(res.status);
},
onLoading: function(req) {
$("main").innerHTML = "<img
src=''/loading.gif''/>";
}
});
Everything works fine in Opera or FF:
1. while foo.php is loading, I see loading.gif image
2. when it''s done, div with id ''main'' is update with
what foo.php
returns.
Now, if I run all that in IE7, very often (not allways) I can see
loaded
page for a fraction of a second and then loading.gif is displayed!
So I added onComplete to see request status code. Now, when
I click on the link which triggers the ajax code:
1. the result from foo.php is nicely shown
2. alert msg pops up with "200" in it.
3. after closing the popup msg - loading.gif is displayed, hiding
correcly loaded content..
why... ? Is there anything I''m doing wrong ?
Thanks for help.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Never mind, I should read docs more carefully.. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
so, for the people who don''t like to read docs and so there is less of a chance of the question being asked again - what was the solution? I''ve got my own way of doing it, but knowing other means is always good... On 10/15/07, lauris <zeronetl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Never mind, I should read docs more carefully.. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well, docs says that onLoading callback is not guaranteed and depends
on browser.
And in this case, IE, as allways, has own (stupid) way of doing
things.
So all I did was not using OnLoading at all. In my js function I first
show the loading img
which then gets overwriten by Ajax.Updater:
function foo() {
$("main").innerHTML = "<img
src=''/loading.gif''/>";
new Ajax.Updater(''main'', ''/foo.php'',
{ method: ''get''});
}
--
lauris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---