Im having some troubles finding information on a good way to take URI data and convert it into JSON using JQuery. Can anyone point me in the right direction? Thanks
Asked
Active
Viewed 253 times
0
-
Could you give an example of the input and output? Maybe [this question about extracting query parameters](http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript) helps. I assume you know how to convert a JavaScript object to JSON. – Felix Kling Mar 19 '12 at 15:46
1 Answers
0
Try here?
and the answer from the question felix pointed out is good too
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}

SpYk3HH
- 22,272
- 11
- 70
- 81