Onkeyup function

Onkeyup function

Hi,

I have been working on the following script:

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

</head>
<body>
<form name="contact" id="contactForm" method="post" action="count.php">

      <label  for="FNO">Enter First no:</label>
      <input type="text" name="FNO" id="FNO" value=""  />
<label for="SNO">SNO:</label>
                        <input type="text" name="SNO" id="SNO" value="" />

      <input type="submit" name="submit" class="button" id="submit_btn" value="Send" />

  </form>

  <!-- The following div will use to display data from server -->
<div id="result"></div>
</body>


  <script>

  /* attach a submit handler to the form */
  $("#contactForm").submit(function(event) {
  /* stop form from submitting normally */ 
  event.preventDefault();

  /* get some values from elements on the page: */
  var $form = $( this ),
  //Get the first value
  value1 = $form.find( 'input[name="SNO"]' ).val(),
  //get second value
  value2 = $form.find( 'input[name="FNO"]' ).val(),
  //get the url. action="count.php"
  url = $form.attr( 'action' );

  /* Send the data using post */
  var posting = $.post( url, { SNO: value1, FNO: value2 } );

  /* Put the results in a div */
  posting.done(function( data ) {

  $( "#result" ).empty().append( data );
  });
  });
  </script>
</html>

















































EDIT: The PHP file basically adds the two numbers and sends back the result.


I have been looking at the onkeyup function however not got a clue on how to add it to this script so the user does not have to slick the submit button.

(I'm a total newbie to jquery and followed a tutorial for the above script)

Thanks,

Jack