Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting error from C# server code while making request through $.ajax
    primarykey
    data
    text
    <p>I am using <code>$.ajax</code> to send request to C# code in Asp.Net.Each time i am getting the error in the response(checked in Firebug) like:</p> <pre><code>{"Message":"Invalid JSON primitive: EmailAddress.","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"} </code></pre> <p>If i remove <code>data:{}</code> parameter from the <code>$.ajax</code> then it is fine.I think there is some problem with my way of sending data to the server.</p> <p>My Client side code is: function send_req() {</p> <pre><code> $.ajax({ url: "Demo.aspx/Demo_Method", contentType: "application/json; charset=UTF-8", type: "POST", data: {"EmailAddress": "abc@testmail.com"}, success: function (response) { alert('Success' + response); } }); } </code></pre> <p>And Demo.aspx.cs page code is:</p> <pre><code>public partial class Demo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } [WebMethod()] public static void Demo_Method(string EmailAddress) { //Some code.... } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload