最近在弄一个页面,要求是点击页面按键,调用到后台C#函数做一些处理
本机测试是正常的,部署后测试有点问题
1.Web.config片段如下:
<httpHandlers> <add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers>
2.javascript代码如下:
<head runat="server"> <title>Test</title> <script language="javascript" type="text/javascript"> function success(result) { } function onClick() { satisfy.table.InsertDatabase("name","pw",function(out){;}); } </script> </head>
后台相关代码如下:
namespace satisfy
{
public partial class table : System.Web.UI.Page
{
protected void Page_Load(object sender,EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(satisfy.table));
}
[AjaxPro.AjaxMethod]
public string InsertDatabase(string name,string pw)
{
return "good";
}
}
}
asp:button代码:
<input name="click" id="click" onclick="onClick();" value="CSR" type="button"/>
个人不太懂asp和网站开发这块?谁能告诉我哪里有问题 谢谢啊?
狐的传说
湖上湖
白猪掌柜的
相关分类