Follow

Get variable values from URL in JavaScript

To get variables from URL you could use next code:

JavaScript
function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
        function (m, key, value) {
            vars[key] = value;
    });
    return vars;
}

var vars = getUrlVars();
report.dictionary.variables.list.forEach(function(item, i, arr) {
    if (typeof vars[item.name] != "undefined") item.valueObject = vars[item.name];
});

viewer.report = report;

0 Comments

Please sign in to leave a comment.
Powered by Zendesk