dont fail on empty qstring
This commit is contained in:
parent
47be3093ae
commit
30f4dedde4
|
@ -216,9 +216,12 @@ function JSONtoQueryString(obj) {
|
||||||
{'var1': 'bar', 'var2': 'baz'}
|
{'var1': 'bar', 'var2': 'baz'}
|
||||||
*/
|
*/
|
||||||
function QueryStringToJSON(qstring) {
|
function QueryStringToJSON(qstring) {
|
||||||
var qstring = qstring.split("?")[1];
|
if (qstring.indexOf("?") == -1) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
var q = qstring.split("?")[1];
|
||||||
var args = {};
|
var args = {};
|
||||||
var vars = qstring.split('&');
|
var vars = q.split('&');
|
||||||
// console.log(vars);
|
// console.log(vars);
|
||||||
for (var i=0; i<vars.length; i++) {
|
for (var i=0; i<vars.length; i++) {
|
||||||
var kv = vars[i].split('=');
|
var kv = vars[i].split('=');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user