當前位置:編程學習大全網 - 源碼下載 - ajax 前臺無法調用後臺方法是返回值為NULL

ajax 前臺無法調用後臺方法是返回值為NULL

光壹個AJAX.dll不行

AjaxControlToolkit.dll

AJAXExtensionsToolbox.dll

還需喲啊這兩個 從網上下吧 至於這兩個是幹什麽用的 自己查吧 我也正看呢 NND挺麻煩的還

-----------------------------------------

我新建的項目 就加載了3個dll文件 和

<httpHandlers>

<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />

</httpHandlers>

為什麽我就出來了~!!

-----------------我的源碼--------------------

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

namespace WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

Ajax.Utility.RegisterTypeForAjax(typeof(_Default));

}

[Ajax.AjaxMethod()]

public string SendMsg()

{

return "123456";

}

}

}

<script>

function aa()

{

var a=_Default.SendMsg().value;

window.alert(a);

}

</script>

</head>

<body>

<form id="form1" runat="server">

<div>

<input id="Button2" type="button" value="button" onclick="aa()" />

[Ajax.AjaxMethod()]

public string SendMsg()

{

return "123456";

}

web.config

<httpHandlers>

<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />

</httpHandlers>

</system.web>

</configuration>

  • 上一篇:系統管理員的基本要求
  • 下一篇:CCTV6電影頻道音樂
  • copyright 2024編程學習大全網