var title = document.title; var url = window.location.href; var xhr = new XMLHttpRequest(); xhr.open("POST", "https://trail.53kf.com/code.php?cmd=ka &action=behavior", true); xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xhr.withCredentials = true; //支持跨域发送cookies xhr.send('title='+title+'&url='+url);