title: passing input text value to ajax call
body: <p>I have to pass string entered in the input text to server method calling through jquery ajax. But its not going through. can please somebody tell me what i m doing wrong here. Below is the code:</p>
  
  <pre><code>$.ajaxSetup({    cache: false    timeout: 1000000}); function concatObject(obj) {    strArray = []; //new Array    for (prop in obj) {        strArray.push(prop + " value :" + obj[prop]);    }    return strArray.join();} //var Eid = "stephen.gilroy1"; function testCAll() {    //var ntid = $('#Eid').val();     $.ajax({        type: "POST",        url: "Testing.aspx/SendMessage",        //data: "{'ntid':'stephen.gilroy1'}",       //working        data: "{'ntid': $('#Eid').val()}",        contentType: "application/json; charset=utf-8",        dataType: "json",        success: function(result) {            alert(result.d);            resultData = eval("(" + result.d + ")");            $("#rawResponse").html(result.d);            //$("#response").html(resultData.sn);        },        error: function(result) {            alert("jQuery Error:" + result.statusText);        }    });}$.ajaxSetup({
      cache: false
      //timeout: 1000000
  });
  function concatObject(obj) {
      strArray = []; //new Array
      for (prop in obj) {
          strArray.push(prop + " value :" + obj[prop]);
      }
      return strArray.join();
  }
  
  //var Eid = "stephen.gilroy1";
  
  function testCAll() {
      //var ntid = $('#Eid').val(); 
      $.ajax({
          type: "POST",
          url: "Testing.aspx/SendMessage",
          //data: "{'ntid':'stephen.gilroy1'}",       //working
          data: "{'ntid': $('#Eid').val()}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function(result) {
              alert(result.d);
              resultData = eval("(" + result.d + ")");
              $("#rawResponse").html(result.d);
              //$("#response").html(resultData.sn);
          },
          error: function(result) {
              alert("jQuery Error:" + result.statusText);
          }
      });
  }
  </code></pre>
  
  <p>above is js file and below is its aspx file:</p>
  
  <pre><code>    &lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Testing.aspx.cs" Inherits="Testing" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="jquery.js" type="text/javascript"&gt;&lt;/script&gt;
  
      &lt;script src="Testing.js" type="text/javascript"&gt;&lt;/script&gt;
  
      &lt;script src="json2.js" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
      Employee's NTID: &lt;input type="text" id = "Eid" name="Employee_NTID" /&gt;
          &lt;asp:GridView ID="GridView1" runat="server"&gt;
          &lt;/asp:GridView&gt;
          &lt;br /&gt;
  &lt;br /&gt;
       &lt;input type="button" onclick="testCAll()" value = "Search"/&gt;
  
         &lt;div id="rawResponse"&gt;&lt;/div&gt;
         &lt;hr /&gt;
         &lt;div id="response"&gt;&lt;/div&gt;
  
      &lt;/div&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>