Javascript get url parameters.

In this article, I will explain  how to get url parameters in javascript.We are using following JavaScript code to get url parameters using javascript.I have written simple javascript function which will get a URL parameter and return it to you.
Suppose,My URL is http://example.com/pagename.html?a=1&b=2 and i want to
get parameters a=1,b=2
please check following code to Retrieve URL GET parameters with Javascript.