Is there a plugin-less way of retrieving query string values via jQuery (or without)?
If so, how? If not, is there a plugin which can do so?
Is there a plugin-less way of retrieving query string values via jQuery (or without)? If so, how? If not, is there a plugin which can do so? |
|||||||||||||||||
|
see this post or use this
|
||||
|
I recommend Dar Lessons as a good plugin. I have worked with it fo a long time. You can also use the following code. Jus put var queryObj = {}; before document.ready and put the bellow code in the beginning of document.ready. After this code you can use queryObj["queryObjectName"] for any query object you have
|
||||
|
Also Refer : |
|||||
|
This is very simple method to get parameter value(query string) Use gV(para_name) function to retrieve its value
|
||||
|
Time for the magic of simplicity...
And if you need to handle
Note that given a URL like |
|||||
|
This will parse variables AND arrays from a URL string. It uses neither regex or any external library.
Example:
Output:
|
||||
|
this will work.. You need call this function where you need get the parameter by passing its name..
|
|||||
|
Simple Solution with Plain JS and Regex
|
||||
|
This didn't work for me, I want to match `?b' as the 'b' paramter is present, and not match '?return' as the 'r' paramrter, here is my solution.
|
||||
|
The shortest possible expression in terms of size to obtain a query object seems to be:
You can make use of the
|
||||
|
Amazing how many overly complicated and incomplete solutions are posted here. Here's what I'm using:
Works with following urls:
Returns an empty string in the first 4 cases, and the string '?&=' in the last two cases. Returning '?&=' rather than 'ignored' in the last case makes it consistent with PHP. Works in IE7. |
||||
|
This function will return a parsed JavaScript object with any arbitrarily nested values using recursion as necessary. Here's a jsfiddle example.
Given any of the above test examples.
|
||||
|
|
||||
|
|
||||
|
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?