<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready( function () { //The page has been loaded...
var ref = document.referrer; //Referrer
var curpg = document.location.href; //Current page URL
var dataSet = 'ref=' + ref + '&curpg=' curpg + '&shizz1e=21';
$.ajax({
type: "GET",
url: "http://www.domainname.com/ajaxreceiver.php",
data: dataSet
});
return false;
});
</script>
我试图在页面加载后立即将“curpg”、“ref”和“shizz1e”变量提交给 ajaxreceiver.php,无需任何用户干预。我还试图避免刷新页面或将客户端重定向到 ajaxreceiver.php。我不确定为什么这段代码不起作用;dataSet 变量永远不会被发送到 ajaxreceiver.php。