steveosoule
4/1/2013 - 9:29 PM

window-params.js

window-params.js

//Create an array of URL parameters passed
window.params = function() {
	var params = {};
	var param_array = (window.location.href.indexOf('?') > -1) ? window.location.href.split('?')[1].split('&') : [];
	for (var i = 0, l = param_array.length; i < l; i++) {
		x = param_array[i].split('=');
		params[x[0]] = x[1];
	}
	return params;
};

console.log(window.params.action);