JS总是无法调用后台AJAX方法,怎么回事?

nozer 2010-08-09 01:40:47
这是我的前台页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
// var xxxx=Default3.TestFun("sdfsdfsdf").value;
function test(){
alert(Default3.TestFun("sdfsdfsdf").value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" id="testid" onclick="test()" value="测试"/>
</div>
</form>
</body>
</html>


这是后台:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(Default3));
}
[AjaxPro.AjaxMethod]
public static string TestFun(string xxxx)
{
return xxxx;
}
}


我已经在bin目录添加了AjaxPro.2.dll


到底怎么回事啊??,求解答,求方法,求步骤,求ErrorMessage
...全文
136 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
nozer 2010-08-14
  • 打赏
  • 举报
回复
找到原因了,Form中没有生民runat server
cherho0 2010-08-09
  • 打赏
  • 举报
回复
webconfig 要配置,static去掉,还有就是加上命名空间试一试
arecaiz 2010-08-09
  • 打赏
  • 举报
回复
webconfig 里面加了没有?
这里没看到错
chsl01 2010-08-09
  • 打赏
  • 举报
回复
没见过这样调用Ajax的方法
等高手答案
wisdonlz 2010-08-09
  • 打赏
  • 举报
回复
我看一这个http://www.cnblogs.com/wcp066/archive/2008/06/11/948921.html
它是用一个方法来接收返回值的,不知道直接像你这样能不能。
wisdonlz 2010-08-09
  • 打赏
  • 举报
回复
虽然没用过AjaxPro,你确定它是这样调用 方法的??
wilensky 2010-08-09
  • 打赏
  • 举报
回复
webconfig 里面加了没有?

参考:http://www.cnblogs.com/wcp066/archive/2008/06/11/948921.html

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧