日期:2014-05-16 浏览次数:20514 次
function get_org(id) {
var url = "/Handler/AjaxHandler.ashx";
var post_data = { id: id };//就是把这段传到handler.ashx里怎么接收?
$.ajax({
url: url,
type: "POST",
dataType: "json",
data: { action: "CallAjax", asm:"Framework.Web",className:"AjaxDemo", form: [post_data] },//我在这里通过form这个参数传递过去的,但是在接收的时候是个null
success: function (data) {
if (data != null && data != "") {
alert(data);
}
},
error: function (XMLHttpRequest, textStatus) {
alert("异常:" + XMLHttpRequest.reponseText + ";Status:" + textStatus);
}
});
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string message = string.Empty;
string action = context.Request.Form["method"];
string assemblyName = context.Request.Form["asm"];
string className = context.Request.Form["className"];
string param = context.Request.Form["form"];
if (string.IsNullOrEmpty(action))
{
message = "调用方法不能为空!";<