• Jump To … +
    breakpoints.js date-parse.js jquery.breakpoints.js jquery.calcRestrainedPos.js jquery.clientRect.js jquery.contentSize.js jquery.cookies.js jquery.css.js jquery.customEvent.js jquery.delimitedString.js jquery.disableEvent.js jquery.hostIframe.js jquery.hoverDelay.js jquery.htmlEncode.js jquery.imageSize.js jquery.isVisibleKeyCode.js jquery.menu.js jquery-menu-exampleskin.js jquery.modalDialog.deviceFixes.js jquery.modalDialog.getSettings.js jquery.modalDialog.header.js jquery.modalDialog.history.js jquery.modalDialog.js jquery.modalDialog.unobtrusive.js jquery.modalDialog.userAgent.js jquery.modalDialogContent.header.js jquery.modalDialogContent.js jquery.msAjax.js jquery.ns.js jquery.partialLoad.js jquery.postMessage.js jquery.proxyAll.js jquery.queryString.js jquery.richTooltip.js jquery.scrollAnchor.js jquery.uncomment.js jquery.url.js pointy.gestures.js pointy.js
  • jquery.queryString.js

  • ¶

    /

    (function ($) {
        var PLUS_RE = /\+/gi;
    
        var urlDecode = function (s) {
  • ¶

    Specifically treat null/undefined as empty string

            if (s == null) {
                return "";
            }
  • ¶

    Replace plus with space- jQuery.param() explicitly encodes them, and decodeURIComponent explicitly does not.

            return decodeURIComponent(s.replace(PLUS_RE, " "));
        };
  • ¶

    Given a querystring (as a string), deserializes it to a javascript object.

        $.deparam = function (queryString) {
            if (typeof queryString != "string") {
                throw new Error("$.deparam() expects a string for 'queryString' argument.");
            }
  • ¶

    Remove “?”, which starts querystrings

            if (queryString && queryString.charAt(0) == "?") {
                queryString = queryString.substring(1, queryString.length);
            }
    
            return $.parseDelimitedString(queryString, "&", "=", urlDecode);
        };
  • ¶

    Alias

        $.parseQueryString = $.deparam;
  • ¶

    Gets the querystring from the current document.location as a javascript object.

        $.currentQueryString = function () {
            return $.deparam(window.location.search);
        };
  • ¶

    Given a url (pathname) and an object representing a querystring, constructs a full URL

        $.appendQueryString = function (url, parsedQueryString) {
            var qs = $.param(parsedQueryString);
            if (qs.length > 0) {
                qs = "?" + qs;
            }
    
            return url + qs;
        };
    
    })(jQuery);