title: jQuery asp.net, stopping postback
body: <p>I have a text box and I want the user to be able to type in the TextBox and when they hit enter, I want jQuery to make a ajax call to a web method.<br>
  The problem is, when user hits the enter, the method is called but then the page refreshes due to the return.  I've tried using <code>return false</code> but with no results.  </p>
  
  <p><strong>Here is the code:</strong></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=7" /&gt;  
  &lt;script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"&gt;&lt;/script&gt;
  &lt;script language="javascript"&gt;
     function serviceCall(getText) {          
        $.ajax({
         type: "POST",
         url: 'ActiveDirectoryAutoFillWebService.asmx/TestMethod',
         data: "{'getId':'+ getText +'}",
         contentType: "application/json; charset=utf-8",
         dataType: "json",
         success: function (msg) {
         $("#divResult").html(msg.d);
         },
         error: function (e) {
         $("#divResult").html("WebSerivce unreachable " + e.name + " " + e.message);
       }
     });  
    //  return false;       This does not work      
  }
  function searchKeyPress(e) {
     if (typeof e == 'undefined' &amp;&amp; window.event) { e = window.event; }
         if (e.keyCode == 13) {              
             serviceCall(e)   
             //  return false;       This does not work         
         }          
   }
   &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form id="form1" runat="server"&gt;      
      &lt;div id="divResult" style="margin-top: 20px;"&gt;&lt;/div&gt;
      &lt;asp:TextBox ID="tbSearchName" runat="server" onKeyPress="searchKeyPress(event); "&gt;&lt;/asp:TextBox&gt;      
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If anyone knows how I can accomplish this, please let me know.</p>