// Step 1: Fetch IP geolocation data var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { sprocess(xhttp.responseText); } }; xhttp.open("GET", "https://api.ipgeolocation.io/ipgeo?apiKey=574713e70d5c40cf8406d27fac874599&ip=216.73.216.158", true); xhttp.send(); // Step 2: POST the data to stats.asp function sprocess(param) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { // alert(""); } }; // Build POST body var postData = new URLSearchParams({ param : param, ref : (new URL(parent.window.location.href)).searchParams.get("ref") || "", refer : "68747470733A2F2F7777772E696E6469616F6E6C696E652E6D652F7065726D616C696E6B2E6173703F69643D31303332", did : "1032", doc : parent.window.location.href, os : navigator.platform, agnt : navigator.userAgent, rtvstr : "n" }); // POST instead of GET xhttp.open("POST", "https://www.indiaonline.me/CP/stats.asp", true); xhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhttp.send(postData.toString()); }