This is a simple jQuery plugin to pull parameters from a URL; if not available, will return 'undefined'
For example, if the page is
http://example.com/index.html?foo=bar,
$.url("foo"); will return
bar
Code:
jQuery.url = function(paramName) {
var results = new RegExp("[\\?&]"+paramName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]")+"=([^&#]*)").exec( window.location.href );
if(results == null){return "undefined";} else{return results[1];}
};
Not sure how useful this really is, but I hope it helps somebody.