调用方法:
-----------后台--------
public partial class Base_WuLSearch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(Base_WuLSearch));//注册类
}
[Ajax.AjaxMethod()] //说明函数是 ajax 方法
public string getWLNum(string WuLNum)
{
return "chy";
}
--------前台-------------------------
<input type="button" />
function callServer()
{
Base_WuLSearch.getWLNum("100-1",CallBack); 调用后台的ajax 函数
}
function CallBack(response) //回掉函数 参数一定为 response
{
alert(response.value); //----------显示 chy
}
----Web.config-------
<system.web>
<httpHandlers>
<add verb="OST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>
</system.web>
呵呵,现在就可以实现 ajax 的效果了!!!!!!
有兴趣的试 一下啦!!!!