PageMethods:
using System.Web.Services;
[WebMethod]
public static string Ok()
{
return "
this is function ok!";
}
注意:using及WebMethod
ScriptManager:
<asp:ScriptManager ID="
sm" runat="
server" EnablePageMethods="
true" >
</asp:ScriptManager>
注意:EnablePageMethods="true",否则无法启用PageMethod
Js:
<script type="
text/javascript">
function btn_click(){
PageMethods.Ok(onSuccessed);
}
function onSuccessed(result){
$
get("
result").innerHTML=result;
}
</script>
结果:
转载于:https://www.cnblogs.com/oneword/archive/2009/05/04/1449120.html
相关资源:数据结构—成绩单生成器