var jQueryScriptOutputted = false; function initJQuery() { //if the jQuery object isn't available if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { jQueryScriptOutputted = true; document.write(""); } setTimeout("initJQuery()", 50); } else { // do anything that needs to be done on document.ready // don't really need this dom ready thing if used in footer $(function () { $.ajax({ type: "POST", url: "/Manage/QCWEService", async: true, data: { type: "insertvisitrecord", cookid:'20a4a919-dc44-4fb5-ac63-222b856c1895',w:screen.width,h:screen.height,pu:window.location.href,pr:document.referrer }, dataType: "json", success: function (jsonObj) { if (jsonObj.Status == 1) {} else{}}}); }); $(window).on('beforeunload unload',function(){$.ajax({ type: "POST", url: "/Manage/QCWEService", async: true, data: { type: "insertvisittimes", cookid:'20a4a919-dc44-4fb5-ac63-222b856c1895',pu:window.location.href}, dataType: "json", success: function (jsonObj) { if (jsonObj.Status == 1) {} else{}}}); });} } initJQuery();