var data=new Object(); data.ip = '18.223.100.85'; data.referrerUrl = document.referrer; data.curUrl = window.location.href; data.curTitle = window.document.title; data.userAgent = navigator.userAgent; (function() { var xhr = new XMLHttpRequest(); xhr.open("POST", "/api/total-save", true); xhr.setRequestHeader("Content-Type", "application/json;charset=utf-8"); xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { console.log(xhr.responseText); } } xhr.send(JSON.stringify(data)); })();