Skip to content

Instantly share code, notes, and snippets.

@libo1106
Created August 24, 2012 06:02
Show Gist options
  • Save libo1106/3446260 to your computer and use it in GitHub Desktop.
Save libo1106/3446260 to your computer and use it in GitHub Desktop.
javascript获取url中的GET参数,并且重新发一个新的xml请求
function clickpost(){
var tracking = 'http://www.demo.com/tracking?type=click&';
var adurl = window.location.href.split("?");
var parameters = adurl[1];
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', tracking + parameters, true);
xmlhttp.send();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open('GET', tracking + parameters, true);
xmlhttp.send();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment