Return to Snippet

Revision: 22653
at January 18, 2010 16:51 by geekyjohn

Initial Code
$.urlParam = function(name){
	var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
	if (!results) { return 0; }
	return results[1] || 0;

Initial URL

Initial Description
This is an improvement on
I found IE wasn't liking the results[1] when no param was set. This fixes that issue.

Initial Title
Get URL Parameters with jQuery | Improved

Initial Tags
url, javascript, jquery

Initial Language