Accessing ajax POST response in javascript
Posted
by
mike44
on Stack Overflow
See other posts from Stack Overflow
or by mike44
Published on 2012-11-26T04:53:17Z
Indexed on
2012/11/26
5:03 UTC
Read the original article
Hit count: 96
I'm making ajax POST request from javascript function:
function UpdateMetrics() {
$.ajax({
type: "POST",
url: "MyHandler.ashx?Param1=value1",
data: "{}",
contentType: "text/json; charset=utf-8",
dataType: "text",
success: function (msg) {
var jsonUpdatedData = msg;
...
}
});
}
From my handler, I'm sending json string with:
context.Response.write(json);
I think I'll get it in msg
.
I also want to send other string (count). So I'm trying to use header info along with json data. So I added this line:
context.Response.Headers.Add("MaxCount",Convert.ToString(tempList.Count));
If this is right way to do it, how can I access it in my success
function?
© Stack Overflow or respective owner