JQuery Progress Bar and ASP.net

JQuery Progress Bar and ASP.net

I am using making application asp.net 2.0. In my page there is Data List which is having two buttons. When user click on the button it is doing some process and taking some time. Due to that user some time click twice and it will make problem in application. So to stop that I wanted to show progress bar until button click process done.

I am using following code 

ASPX Page Code


  1. <script language="javascript" src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
  2. <script language="javascript" src="js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
  3. <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  4.  
  5. <script type="text/javascript">
  6.       $(document).ready(function() {
  7.             $("#progressbar").progressbar({ value: 0 });
  8.             $("#addtocart").click(function() {
  9.                 var intervalID = setInterval(updateProgress, 250);
  10.                 $.ajax({
  11.                     type: "POST",
  12.                     url: "AutoComplete.asmx/GetText",
  13.                     data: "{}",
  14.                     contentType: "application/json; charset=utf-8",
  15.                     dataType: "json",
  16.                     async: true,
  17.                     success: function(msg) {
  18.                         $("#progressbar").progressbar("value", 100);
  19.                         $("#result").text(msg.d);                        
  20.                         clearInterval(intervalID);
  21.                     }
  22.                 });
  23.                 return false;
  24.             });
  25.         });

  26.         function updateProgress() {            
  27.             var value = $("#progressbar").progressbar("option", "value");
  28.             if (value < 100) {
  29.                 $("#progressbar").progressbar("value", value + 1);                
  30.             }
  31.         }        
  32.  </script>

  33. <div id="progressbar"></div> 
  34. <div id="result"></div>

Above code is not working may be as datalist is making different name to the control at runtime. Next thing may be I am missing something.

I also want to change the look of the progress bar. Also want to write some text on it like adding ...

How can I do that.