Posted By


cliffpyles on 10/25/11

Tagged


Statistics


Viewed 77 times
Favorited by 0 user(s)

jQuery.extractQuery.js


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function extractQuery(linkElementArg) {
  2. var hrefLink = $(linkElementArg).attr('href'); //href value of link provided
  3. var hrefQuery = hrefLink.split('?'); //query appended the the href URL
  4. var hrefPairs = hrefQuery[1].split('&');
  5. var href = {}; //dictionary containing query as key/value pairs
  6. for (var h in hrefPairs) {
  7. var pair = hrefPairs[h].split('=');
  8. href[pair[0]] = pair[1];
  9. };
  10. return href;
  11. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.