//前端JS
function CallHandlerByJquery()
{
var url = "http://" + window.location.hostname + "/Helper.ashx?FLAG=2&BIZINST_GUID=276259&callback=?&rand="+Math.random();
$.ajaxSettings.async = false;
$.getJSON(url, function (data)
{
alert(data.state + "|" + data.msg);
});
} //后台方法
public void ProcessRequest(HttpContext context)
{
string jsonResult = string.Empty;
string callback = context.Request.QueryString["callback"];
//业务逻辑
jsonResult = "{state:'0',msg:'操作失败'}";
}
context.Response.ContentType = "application/json";
context.Response.Write(callback + "(" + jsonResult + ")");
context.ApplicationInstance.CompleteRequest();

  

05-04 06:25