$(document).ready(function() { var referrer=parent.document.referrer; if( referrer=="" ) referrer=document.referrer; $.ajax({ type: "get", url: "../index/counter.jsp", data: "url="+encodeURIComponent($("#TutorChineseCounterJsId").attr("url"))+"&referer="+encodeURIComponent(referrer)+"&randtime="+new Date().getTime(), error: function(err) { //alert("ajax error"); }, success: function(responseText) { //alert("ajax success"); } }); });