Merge pull request #363 from kosmasgiannis/query_parse
Better parsing of query string variables
This commit is contained in:
commit
dd3a8a1b6d
|
@ -78,7 +78,7 @@ WebUtil.dirObj = function (obj, depth, parent) {
|
||||||
|
|
||||||
// Read a query string variable
|
// Read a query string variable
|
||||||
WebUtil.getQueryVar = function(name, defVal) {
|
WebUtil.getQueryVar = function(name, defVal) {
|
||||||
var re = new RegExp('[?][^#]*' + name + '=([^&#]*)'),
|
var re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
|
||||||
match = document.location.href.match(re);
|
match = document.location.href.match(re);
|
||||||
if (typeof defVal === 'undefined') { defVal = null; }
|
if (typeof defVal === 'undefined') { defVal = null; }
|
||||||
if (match) {
|
if (match) {
|
||||||
|
|
Loading…
Reference in New Issue