• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

How to change cursor icon ?


I have a AJAX form in ASP.Net. Lately, I have been getting an exception: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The sttaus code returned from the server was: 500

This is mostly due to the fact that the user is trying to submit the form 2 times, since the response back from the AJAX is slow. This also results in duplicate records being added in the system.

I would like the user to know that the current process (say if they click on a button) is not yet complete, by changing the cursor icon to a hourglass. The cursor icon should revet back to original state once the page response  is processed.

Please let me know how I could implement this cursor functionality?

Thanks in advance.
  • 2
1 Solution
Would be easier to change your ajax transaction to synchronous
So the browser wont accept input until the transaction is completed.

ajax_object.open("POST", "server.php", false);
You can couple that with a javascript function to change your curser

<script type="text/javascript">
function cursor_wait() {
  document.body.style.cursor = 'wait';

function cursor_clear() {
  document.body.style.cursor = 'default';

Call cursor_wait(); before your ajax open function
cursor_clear(); after your good response.
Eric_ShugartsAuthor Commented:

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now