Hi guys,
I am trying to execute a webservice method call from the javascript on the page, just before the user leaves the page. I got the javascript speaking the webservice perfectly. However, when I try to hook the javascript function to the window.onbeforeunload event, nothing happens.
<script type="text/javascript" language="javascript">
window.onbeforeunload = LogEnd;
function LogEnd() {
OnlineAgent.AnalyticsService.FeatureUseEndLog(63, OnCallComplete, OnCallFailed);
}
function OnCallComplete(result) {
//var elem = $get("Results");
//elem.innerHTML = result;
}
function OnCallFailed(result) {
//var elem = $get("Results");
//elem.innerHTML = "Failed: " + result;
}
</script>
The method on the webservice returns no values. I am unsure what to do with the onsuccess and onfailed callback functions, so I placed empty functions.
Any ideas guys? Has anyone tried to do this before?