jQuery getUrlQueryString.js plugin

Few months when we are posting a content about accessing query-string using JavaScript, we got good response from the user side. Now its available in jQuery getUrlQueryString.js plugin which will support both html and serverside.

Also it will return value in array or object format, lets see about jQuery getUrlQueryString.js.
getUrlQueryString.js will allow user to pass url with or without query-string and split then return the values in form of array and object format.

First we need to include jQuery library file and getUrlQueryString.js

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="getUrlQueryString.js"></script>

Now we are going to call $.getUrlQueryString function and passing current url, so we have mentioned windows.location.href which will send current url with or with query-string.

<script>
// Below url with display query string if its present or not
var query = $.getUrlQueryString(window.location.href);
alert(query.q +" or "+ query["q"]);
</script>

Above variable will return q value in array and object format, if the parameter exists.

Source url
https://github.com/benayapaul/getUrlQueryString.js
http://plugins.jquery.com/getUrlQueryString.js/

Share