js文件
$(function () {
$("#BtnEnroll").click(function () {
$.get("EnrollHandler.ashx",
{
user: $("#txtUser").val()
}, //2.参数
function (data, status) {
alert(data);
if (status != "success") {
return; //ajax执行失败
}
if (data != "true") {
return;
}
alert("成功!");
//显示
}); //3.回调函数
});
});
一般处理文件
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace IndoorsMW
{
///
/// EnrollHandler 的摘要说明
///
public class EnrollHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string strUsername = context.Request.QueryString["user"];
context.Response.Write(strUsername);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
跪求大神指点,为什么get方法里面没有得到值,没有进入get方法。