I've been trying to call ac# function in javascript this way :
function x() { PageMethods.F1(onSucess, onError); function onSucess(result) { alert('Success'); } function onError(result) { alert('Something wrong.'); } }
[WebMethod]
public static boolean F1()
{
return true;
}
<asp:Button ID="Button1" runat="server" OnClientClick="x(); return false" Text="Button" />
But I don't get any result, I mean neither of the alert messages pops up. What exactly is wrong ?
在ScriptManager
上将EnablePageMethods
设置为true 。
<asp:ScriptManager EnablePageMethods="True" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.