from my client side i send json data to data.ashx file but i am not being able to read data from ProcessRequest method of ashx file. just can not understand why i am getting null
this way i am sending data from client side to ashx file
var FeedCrd = {};
FeedCrd["Name"] = $("input[id*='txtName']").val();
FeedCrd["Subject"] = $("input[id*='txtSubject']").val();
FeedCrd["Email"] = $("input[id*='txtFEmail']").val();
FeedCrd["Details"] = $("textarea[id*='txtDetails']").val();
$.ajax({
type: "POST",
url: urlToHandler + "?ac=send",
data: JSON.stringify(FeedCrd),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data == "SUCCESS");
{
//
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
here is my ashx file code for ProcessRequest
public void ProcessRequest(HttpContext context)
{
string outputToReturn = "";
context.Response.ContentType = "text/html";
if (context.Request.QueryString["ac"] == "send")
{
string sName = context.Request["Name"];
string sSubject = context.Request["Subject"];
outputToReturn = "SUCCESS";
}
context.Response.Write(outputToReturn);
}
i have also seen how data is going to server side using firebig. here is the data {"Name":"cvv","Subject":"fdsfd","Email":"dsdsa@xx.com","Details":"wow"}
so please help me how to read data from ashx file when json send from client side. please tell me where i made mistake. please guide me. thanks