$.post("xxx.ashx",{参数名:参数值},function(msg){ })
$.ajax({
type:"POST",
url:"handler.ashx",
data:{ firstName:'stack', lastName:'overflow'},
// DO NOT SET CONTENT TYPE to json
// contentType: "application/json; charset=utf-8",
// DataType needs to stay, otherwise the response object
// will be treated as a single string
dataType:"json",
success:function(response){
alert(response.d);
}
});
usingSystem;
usingSystem.Web;
usingNewtonsoft.Json;
publicclassHandler:IHttpHandler
{
publicvoidProcessRequest(HttpContext context)
{
context.Response.ContentType="text/plain";
string myName = context.Request.Form["firstName"];
// simulate Microsoft XSS protection
var wrapper =new{ d = myName };
context.Response.Write(JsonConvert.SerializeObject(wrapper));
}
publicboolIsReusable
{
get
{
returnfalse;
}
}
}
ajax,哈哈,jquery支持的。读一下jquery ajax api就成,非常简单。
ajax,可以实现的
ajax 的运用搞好了。自己这方面得加强了