I'm using an AJAX post like this:
$.ajax({
type: "POST",
url: "/AJAXServices.aspx/" + method,
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
successfunc();
},
error: function(data) {
errorfunc();
}
});
When I use the variable "params" like this:
var params = '{"QuestionID":"' + UpdateQuestion_ID + '", "NewText":"' + newText + '"}';
It works.
But when I change it to this:
var params = { QuestionID: UpdateQuestion_ID, NewText: newText };
This throws an internal server error on the server side:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Server side method:
[WebMethod]
public static void UpdateQuestion(string QuestionID, string NewText)
{
....
}
Any ideas?