.... a click on the anchor will do this in this order -act like its loading a page (the important part) -make the ajax call -when the ajax call is successful it follows the link -if the ajax is unsuccessful, nothing happens
i'm trying to duplicate that with the click of a <button> or the change of an input field. the part i'm missing is when the user clicks the button the browser just sits and waits for the ajax call to finish then on success it starts to load the new page.
Msg#: 3975390 posted 4:30 am on Aug 20, 2009 (gmt 0)
I would check in your callback function, that when the XML request has returned successfully, that you redirect at that moment, using something like the following: document.location = 'page.php';
You never want to say something like "well this browser does it this way" because you never know if that will be the same behavior on another browser, perhaps another version, or whatever the case may be. You always want to know exactly what is going to happen and when. Doing it the way I explain should achieve this effect.
Msg#: 3975390 posted 5:05 am on Aug 20, 2009 (gmt 0)
thats exactly what i did for the button scenario.... the only side effect is when the user clicks the button, the browser doesn't act like its doing anything until the ajax completes and then it redirects. I want the user to be able to tell their click is doing its thing.
Msg#: 3975390 posted 4:25 pm on Aug 20, 2009 (gmt 0)
All AJAX applications have that problem. Most of us "solve" it by adding a little animated gif (called a "spinner") near whatever object triggered the event. So if they click a link, have spinner appear next to the link, until the AJAX request resolves itself.
Msg#: 3975390 posted 6:37 pm on Aug 20, 2009 (gmt 0)
I was leaning toward a solution like that... but i was thinking a "wait" cursor, so i did a...
document.body.style.cursor = 'wait' ;
but if the body doesn't fill the window, its the arrow cursor in the non-body part of the window. whats the proper way to do this?