Organizational Research By

Surprising Reserch Topic

message invalid json primitive ajax jquery method with c sharp webmethod using -'c#,jquery,asp.net,html,asp.net-ajax'


message invalid json primitive ajax jquery method with c sharp webmethod  using -'c#,jquery,asp.net,html,asp.net-ajax'

I have code like this : i am using Data value as object literal, instead of concatenating a String. WHY? see here

my code is this:-

$.ajax({
                    url: "../Member/Home.aspx/SaveClient",
                    type: "POST",
                    async: false,
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    data: {
                        "projectSoid": ProjectId,
                        "startDate": StartDate,
                        "endDate": EndDate,
                        "clientManager": ClientManager
                    },
                    success: function (response) {
                        if (response.d != "") {

                        }
                    },
                    error: function (response) {
                        var r = jQuery.parseJSON(response.responseText);
                        alert("Message: " + r.Message);
                        alert("StackTrace: " + r.StackTrace);
                        alert("ExceptionType: " + r.ExceptionType);
                    }
                })


and webmethod is like this :

[WebMethod]
        public static string SaveClient(string projectSoid, string startDate, string endDate, string clientManager)
        {}


Problem is i got error like this:


  Message: Invalid JSON primitive: projectSoid

    
asked Sep 7, 2015 by rajesh
0 votes
28 views



Related Hot Questions



Government Jobs Opening


...