//前台
var url = "Handle/SendMsg.ashx";//请求路径,自己定义路径
var data = { action: "SendMessage", parameter1: "值", parameter2: "值" }; //action后面得字符串是请求的函数,parameter是参数
$.ajax({
type: "POST",
async: true,
url: url,
data: data,
Error: function(msg, status) {
//请求失败....
},
success: function(msg) {
//请求成功,具体业务逻辑操作....
}
});
//后台
public void SendMessage(HttpContext context)
{
string strparameter1 = HttpContext.Current.Server.UrlDecode(context.Request.Params["parameter1"].ToString());
string strparameter2 = HttpContext.Current.Server.UrlDecode(context.Request.Params["parameter1"].ToString());
//具体业务逻辑操作...
}
这样就可以通过AJAX实现局部刷新了。