hi, i am facing a problem here, i really could not find a way to be able to strip out the values of my following JSON Object in a web method
ASPX Code
$(document).ready(function () {
// Add the page method call as an onclick handler for the div.
$("#Button1").click(function () {
$.ajax({
type: "POST",
url: "Default.aspx/MethodCall",
data: '{
"Call" : '{ "Type" : "U", "Params" : [ { "Name" : "John", "Position" : "CTO" } ] } }', contentType: "application/json; charset=utf-8", dataType: "json", cache: true,
success: function (msg) {
// Replace the div's content with the page method's return.
$("#Result").text(msg.d);
},
error: function (xhr, status, error) {
// Display a generic error for now.
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
});
});
});
ASPX.CS Code
[WebMethod]
public static string MethodCall(JObject Call)
{
return "Type of call :"+ Call.Type + "Name is :" + Call.Params.Name + "Position is :"
Call.Params.Position ;
}
thanks a lot in advanced.