this way i am sending my json data
this way i construct my json data like below one
function Post(carousel, first, last, per_page, page) {
var json = "{'Name':'" + $("input[id*='txtName']").val() +
"','Subject':'" + $("input[id*='txtSubject']").val() +
"','Email':'" + $("input[id*='txtEmail']").val() +
"','Message':'" + jQuery.trim($('.message').val()) + "'}";
$.ajax({
type: "POST",
url: "Feedback.aspx/SaveData",
data: json ,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
'here is my success code'
}
});
}
so i just want to know how to write the code in the server side with c# which will deserialize my json data to a feedback class.
my feedback class has same property like name,subject,email,message etc. so tell me how to fill the feedback class with deserialization.
please help me with code. thanks
You actually don’t need to do anything. ASP.NET will do it for you. Just define your method with the appropriate parameters, and it will work automagically:
Or since you already have this class defined, you just need to wrap your javascript fields around an object: