PJ6 wrote:
AJAX is great but I'd like to prevent users from clicking anything again and
causing more actions to happen while the server is working on the current
request without changing the contents of the page. I already set the pointer
to a wait cursor.
What's the best way to disable OnMouseDown document-wide?
Paul
Rather then trying to disable mouse actions, try disabling script
actions...
For example, set a Global variable when the request is sent to the
server
xmlhttp=new XMLHttpRequest()
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("GET",url,true)
xmlhttp.send(null)
Processing = true; //now we know that we are waiting for a response
then in the stateChange function (the current request was completed)...
function xmlhttpChange() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
Processing = false;//now we know we've had a successful response
}
}
now before execution of any other function code, wrap a
function OtherPageAction() {
if (!Processing) {
//do other page actions like normal
} else {
UpdateSomeUserMessage("Processing... Please Wait");
}
}
This would obviously need to be tailored to your script, but I hope the
concept helps.