Newbie to AJAX: creating a counter

Newbie to AJAX: creating a counter

To get my feet wet, I have a simple page where I start a loop and I want to display the count:

  1.   <body>
  2.   <?php
  3.   $rvars = $_REQUEST;
  4.   if (isset($rvars["start"])) {
  5.     for ($i = 0; $i < 10; $i++) {
  6.       // The count variable
  7.       $count = $i;
  8.       sleep(1);
  9.     }
  10.     echo "Finished";
  11.   }
  12.   ?>
  13.   <h1> Test AJAX counter</h1>
  14.   <form id="countform" method="post">
  15.     <div>
  16.     <label for="start_button">Press to start:</label>
  17.     <input type="submit" value="Start" id="start_button" name="start" />
  18.     </div>
  19.   </form>
  20.   // Show count here
  21.   <div id="count_results"></div>
  22.   </body>

About as far as I have gotten is below, but I may be off to an incorrect start.  Any help to get me started would be appreciated.


  1.       $(document).ready(function() {
  2.      updateStatus:function(){
  3.    $.ajax({ 
  4.    type:'post',   
  5.    data:'count='+ parseInt(this.count),
  6.    url: "http://www.toddcary.com/test/ajax3/index.php",
  7.       success: function(){ 
  8.           }
  9.         )
  10.       }); // ready