Get query string parameters with jQuery

$.urlParam = function (name) {
    var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                      .exec(window.location.href);
    if (results == null) {
         return 0;
    }
    return results[1] || 0;
}

console.log($.urlParam('dotmaui')); //cool

Leave a Comment

Your email address will not be published. Required fields are marked *