Reputation: 401
$.ajax({
url : "Handler1.ashx",
type : "GET",
cache : false,
data : {
type : "refresh",
point: [x:1,y:2]
});
The "type" can be "POST". In "Handler1.ashx", I have "HttpContext" object, so how can I get the json from the "HttpContext" object?
I found it is misunderstanding,I means:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
// How can I get json here?
}
Upvotes: 0
Views: 662
Reputation: 3574
Similar to this question. pass jquery json into asp.net . Follow the link, it might be useful for you.
Upvotes: 1
Reputation: 13213
You need to use the success
callback to capture the data returned from the request, as shown below:
$.ajax({
url : "Handler1.ashx",
type : "GET",
cache : false,
data : {
type : "refresh",
point: [x:1,y:2]
},
success: function(responsedata){
alert(responsedata); // <-- there's your data
}
});
Upvotes: 0
Reputation: 5813
Use success callback to get your json data
Following code may help you..
$.ajax({
url : "Handler1.ashx",
type : "GET",
cache : false,
data : {
type : "refresh",
point: [x:1,y:2]
},
success: function(res){
//do your code.
//here res is your json which you return from Handler1.ashx
console.log(res);
}
});
Upvotes: 1