現在、AJAX 対応の WCF を介してデータベースで更新しようとしていますが、サービスで契約関数をトリガーできないようです。誰にもアイデアはありますか?私はすでにスクリプトマネージャとサーバーへの参照を配置しており、同じページ内で同じ理論をすでに適用しており、他の機能は完全に機能していますが、これは機能していないようです。
これが私のコードです
window.onbeforeunload = function () {
alert("alerting server");
var service = new ServiceNameSpace.Service();
service.Function(document.getElementById("info2").value,
document.getElementById("Info1").value, Recieves,
FailsRecievesLogout, null);
}
[OperationContract]
public void DoWork(string info2, string info1)
{
//code
}
マークアップ:
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
<Services>
<asp:ServiceReference Path="~/ServiceName.svc" />
</Services>
</asp:ScriptManager>