Ajax在本地是可以调用后台方法的,可是上传到服务器空间报
错误:'WebAllUpdate'未定义
--WebAllUpdate.aspx
<body onload="updateselectall()">
<form id="form1" runat="server">
</form>
</body>
--WebAllUpdate.cs
public partial class WebAllUpdate : System.Web.UI.Page
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(WebAllUpdate));
}
方法:
[AjaxMethod]
public string UpdateSelectAll()
{
return Session["role_allwebid"].ToString();
}
[AjaxMethod]
public int SelectAll()
{
int count = (int)DBHelper.GetScalar("select count(*) from smenu");
return count;
}
Web.Config
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>
</httpHandlers>
js----
<script type="text/javascript">
function updateselectall()
{
var num=WebAllUpdate.UpdateSelectAll().value;
var count=WebAllUpdate.SelectAll().value;
}
</script>