I'm trying to call a server method from javascript and the call returns the error message "The server method 'IsQueueEmpty' failed." On the server I have:
protected void Page_Load(object sender, EventArgs e)
{
(this.Master as MainMaster).ScriptManager.EnablePageMethods = true;
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod(UseHttpGet = true, ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
public static bool IsQueueEmtpy()
{
return true;
}
On the client side I have the following:
<script type="text/javascript">
function onSuccess(complete) {
if (!complete) {
watchQueue();
}
}
function onError(result) {
alert(result);
}
var watchQueue = function () {
setTimeout(function () {
PageMethods.IsQueueEmpty(onSuccess, onError);
}, 2000);
}
watchQueue();
</script>
Any suggestions would be greatly appreciated.