function urlWithQuery(url, query) {
        var parser = document.createElement('a');
            parser.href = url;
            parser.search = (query[0]=='?') ? query : '?' + query;

        return parser.href;
    }
urlWithQuery
@param {String} url
@param {String} query