现在的位置: 首页 > 综合 > 正文

.net js调用后台ajax方法

2012年12月31日 ⁄ 综合 ⁄ 共 439字 ⁄ 字号 评论关闭

我添加的dll为:Ajax.dll

可下载数:20共享链接:http://163.fm/S4dWNIS        提取码:j1Aaf7qM

1:web.config里面添加:

<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>

2:在page_load里面添加语句

protected void Page_Load(object sender, EventArgs e)
{
  Ajax.Utility.RegisterTypeForAjax(typeof(Register));
}

3:前台JS

 var result = Register.CopyImage(imagePath);

4:后台ajax方法

[Ajax.AjaxMethod()]
public void CopyImage(string imagePathClient)
{
    ........
}

抱歉!评论已关闭.