嗨,大家好,我試圖使用ToolkitScriptManager從CS獲取數據到JS。 這是我的aspx:ASP.net PageMethods返回undefined
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../assets/lib/jquery/jquery-2.0.3.js" type="text/javascript"></script>
<script>
$(window).load(function() {
alert(PageMethods.isConnected());
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager runat="Server"
EnablePageMethods="true"
EnablePartialRendering="true" />
<div>
</div>
</form>
</body>
</html>
,這背後是
[ScriptMethod, WebMethod]
public static bool isConnected()
{
return true;
}
我不知道我的代碼,但這種保留的結果不確定的,對不起,如果這是真的對你簡單的問題,但對我來說如此努力,因爲我是新的在asp.net 請幫我解決這個問題。
看看這個:http://forums.asp.net/t/993893.aspx –