62,046
社区成员
发帖
与我相关
我的任务
分享
$.ajax({
type: "options",
url: "../Ashx/Handler1.ashx",
dataType: "json",
async: false,
success: function (data) {
alert("true");
}
});
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string a = "{\"total\": 1,\"rows\":[{\"PT_ID\":1,\"PT_ParentID\":0,\"PT_Name\":\"鞋子\",\"PT_Code\":\"Shoes\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null},{\"PT_ID\":2,\"PT_ParentID\":0,\"PT_Name\":\"dfaz\",\"PT_Code\":\"asfaf\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null}]}";
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
context.Response.Write(a);
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string a = "{\"total\": 1,\"rows\":[{\"PT_ID\":1,\"PT_ParentID\":0,\"PT_Name\":\"鞋子\",\"PT_Code\":\"Shoes\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null},{\"PT_ID\":2,\"PT_ParentID\":0,\"PT_Name\":\"dfaz\",\"PT_Code\":\"asfaf\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null}]}";
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.Write(a);
}
[/quote]
你的都是get请求呢,没有options请求public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string a = "{\"total\": 1,\"rows\":[{\"PT_ID\":1,\"PT_ParentID\":0,\"PT_Name\":\"鞋子\",\"PT_Code\":\"Shoes\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null},{\"PT_ID\":2,\"PT_ParentID\":0,\"PT_Name\":\"dfaz\",\"PT_Code\":\"asfaf\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null}]}";
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
context.Response.Write(a);
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string a = "{\"total\": 1,\"rows\":[{\"PT_ID\":1,\"PT_ParentID\":0,\"PT_Name\":\"鞋子\",\"PT_Code\":\"Shoes\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null},{\"PT_ID\":2,\"PT_ParentID\":0,\"PT_Name\":\"dfaz\",\"PT_Code\":\"asfaf\",\"CompanyInfo_ID\":null,\"PT_CreateTime\":null}]}";
context.Response.StatusCode = (int)HttpStatusCode.OK;
context.Response.Write(a);
}