Skip to content

Instantly share code, notes, and snippets.

@slopeofhope81
Created February 20, 2014 13:11
Show Gist options
  • Save slopeofhope81/9113201 to your computer and use it in GitHub Desktop.
Save slopeofhope81/9113201 to your computer and use it in GitHub Desktop.
my latest endeavor with javascript
function loadasync(url){
var head=document.getElementsByTagName("head")[0];
var script=document.createElement("script");
script.src=url;
head.appendChild(script);
}
function urlArg(){
var args = {};
var query = window.location.search.substring(1);
var pairs = query.split("&");
for (var i =0; i < pairs.length; i++){
var pos = pairs[i].indexOf("=");
var name = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
value = decodeURIComponent(value);
args[name]=value;
}
return args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment