title: Invoke server side method using XMLHttpRequest
body: <p>how can i directly call my own server side function using XMLHttpRequest.</p>
  
  <p>suppose i have one static webmethod in my aspx file then how can i call it by XMLHttpRequest. what header info i need to pass to asp.net engine and as a result asp.net engine can invoke my method and return the response back in the out going stream.</p>
  
  <p>this way i need to call my server side method</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  var request;
  
  // A
  // Here is the new function that is called when the user submits the form.
  // This example uses POST.
  function submitCallback() {
      var inputValue = document.getElementById("SearchInput").value;
      var sendStr = "name=" + inputValue;
      request = new XMLHttpRequest();
  
      // B
      // Specify the POST method and send it.
      request.open("POST", "Default.aspx/Getdata");
      request.onreadystatechange = readyCallback;
      request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      request.setRequestHeader("IsLookup", "true");
      request.send(sendStr);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>please guide me....thanks</p>