Posted By

cliffpyles on 10/25/11


Tagged


Versions (?)

jQuery.extractQuery.js


 / Published in: Other
 

  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  

You need to login to post a comment.