JS前端调用后台方法

//JS前端代码
function Exportqmdltb() {
var areavalue= GetQmdltmValue();
$.ajax({
type: "post",
dataType: "text",
url: "./GisUtility/GeometryHelper.ashx",//文件路径
data: { "action": "exportqmdltb", "areavalue": areavalue },
beforeSend: function () {
},
complete: function () {
},
success: function (data) {
alert("导出成功:"+data);
},
error: function (ex) {
alert("导出失败:" + ex);
}
});
}
 //GeometryHelper.ashx文件代码(后台代码)
public void ProcessRequest(HttpContext context)
{
string pGeoJson = string.Empty; if (context.Request.Params["action"] == "exportqmdltb")//
{
string areavalue = context.Request.Params["areavalue"];
string tile = "面积统计表";
pGeoJson= CommUtility.ExportQmdltb2Excel(tile,areavalue);//要调用的后台方法
}
context.Response.Write(pGeoJson);//返回到前端的结果 }
上一篇:生成Area URL链接


下一篇:openstack系列文章(1)devstack安装测试Queens