Lets say you have a new user registration page where you validate user entered loginid against the database using Ajax and immediately display available or not.
for this you might do like..
1. Detect onChange event of the text fieldSometimes it may take a while for ajax to complete the process of calling the remote database and read back responseXML, now if you want to show a loading or processing screen for that moment ?, just use this tip.
2. read input and call Ajax
3. process ajax output and display availability in the adjacent div or span tag using innerHTML.
While onChange event of the text field occurs...
function loginID_OnChange(){
//set the div tag to show loading message
document.getElementById("opmsg").innerHTML = " checking availability...";
// call the ajax for checking the loginid
var result = myAjaxFunction(loginidvalue);
// show the new value in the div tag
document.getElementById("opmsg").innerHTML = result;
}
LoginID:
checking availability...
Password: ....
checking availability... Password: ....
LoginID: loginid not available. Please try another.
Password: ....
Password: ....
You can also find some animated activity gif from this site.
TrackBacks[0]
Comments[1]
Posted by balajidl on 13 January 2006 22:22:59 CET
Reply |
Permalink
Re: How to show loading message for AJAX applications?
Cheers mate!! It helped me
Comment from Anonymous on 05 March 2008 21:45:08 CET
TrackBack to http://radio.javaranch.com/balajidl/addTrackBack.action?entry=1137187379092
