Hi all,
im calling page method on mouse over of image slider to show image from database. The problem is i'm getting multiple call backs. So does any one have idea on resolving this issue.
Thanks, Mehul Makwana.
Code which i'm using for page method.
var contextArray = "img";
pageMethodConcept = {
callServerSideMethod: function (id) {
PageMethods.GetItemLargeImage(id, pageMethodConcept.callback, pageMethodConcept.Failcallback, contextArray);
}, callback: function (result, userContext, imagePreview) {
//alert(result);
if (userContext = "img") {
//replace img source with result
document.getElementById("displayPreviewImage").src = result;
return false;
}
}, Failcallback: function (result, userContext) {
alert("failed");
}
}
Code for setting timer,
var alertTimer = 0;
if (alertTimer == 100) {
alert("time 100");
alertTimer = setTimeout(pageMethodConcept.callServerSideMethod(this.id), 0);
}
else {
alertTimer = setTimeout(pageMethodConcept.callServerSideMethod(this.id), 100);
alert("time ");
}