读书人

为什么小弟我的ajax报错呢

发布时间: 2012-03-21 13:33:15 作者: rapoo

为什么我的ajax报错呢?
我是按照网上的一个例子写的,大致内容如下:
前题:引用了ajax.dll
1:在web.config里面写:
<httpHandlers>
<add verb= "POST,GET " path= "ajax/*.ashx " type= "Ajax.PageHandlerFactory, Ajax " />
</httpHandlers>

2:在Test.AjaxClass.cs类文件里写

[Ajax.AjaxMethod()]
public static string GetUserName()
{
return "Helloworld ";
}

3:在Test.WebForm1.aspx.cs的Page_Load里写:
Ajax.Utility.RegisterTypeForAjax(typeof(Test.AjaxClass));

4:在Test.WebForm1.aspx页面写:
<INPUT style= "Z-INDEX: 101; LEFT: 232px; POSITION: absolute; TOP: 136px " type= "button " value= "Button " onclick= "btnClick() ">

<script language= "javascript ">
function btnClick()
{
Test.AjaxClass.GetUserName(ServerSideAdd_CallBack);
}
function ServerSideAdd_CallBack(response)
{
alert(response.value);
}
</script>


运行WebForm1.aspx,点击button,报脚本错误错:
Test未写义,昨晚搞了好晚都没搞定,我以前用过ajax好像就是这样配置的


[解决办法]
谁知道。。。。。
问题解决就好。。。。。。

读书人网 >asp.net

热点推荐