title: Call c# code behind from jquery with parameters
body: <p><strong>Ajax Code</strong></p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "LiveFeed.aspx/SearchStateList",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (response) {
          $("#Content").text(response.d);
      },
      failure: function (response) {
          alert(response.d);
      }
  });
  </code></pre>
  
  <p><strong>Code Behind</strong></p>
  
  <pre><code>[WebMethod]
  public static string SearchStateList()
  {
  
  }
  </code></pre>
  
  <p>The above code works fine and the code behind is called</p>
  
  <p>But when I send some parameter as given below, code behind is not invoked and when I see the Firebug console errors, it throws </p>
  
  <blockquote>
    <p>NetworkError: 500 Internal Server Error -
    <a href="http://localhost:61276/App/LiveFeed/LiveFeed.aspx/SearchStateList" rel="nofollow">http://localhost:61276/App/LiveFeed/LiveFeed.aspx/SearchStateList</a></p>
  </blockquote>
  
  <p><strong>Ajax Code</strong></p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "LiveFeed.aspx/SearchStateList",
      contentType: "application/json; charset=utf-8",
      data:{value:"samplevalue"},
      dataType: "json",
      success: function (response) {
          $("#Content").text(response.d);
      },
      failure: function (response) {
          alert(response.d);
      }
  });
  </code></pre>
  
  <p><strong>Code Behind</strong></p>
  
  <pre><code>[WebMethod]
  public static string SearchStateList(string value)
  {
  
  }
  </code></pre>
  
  <p>I also tried to change modify the data of ajax call as </p>
  
  <pre><code>var param={value:"samplevalue"}
  
  data:JSON.stringify(param),
  </code></pre>
  
  <p>and also tried directly with out JSON.stringify </p>
  
  <pre><code>data:param,
  </code></pre>
  
  <p>Every time when I tried to pass a parameter it did not invoke code behind and 500 error is thrown.</p>