Function to obtain a URL parameter passed by GET from JavaScript. If the parameter does not exist returns null.
// Helper function to get parameters from the query string. function getUrlParam(paramName) { var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i'); var match = window.location.search.match(reParam); return (match && match.length > 1) ? match[1] : null; }