Posted By

wza on 11/18/09


Tagged

get url textmate variables jquery extend


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

nerdfiles


get url variables jquery extend


 / Published in: Other
 

  1. $.extend({
  2. getUrlVars: function(){
  3. var vars = [], hash;
  4. var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  5. for(var i = 0; i < hashes.length; i++)
  6. {
  7. hash = hashes[i].split('=');
  8. vars.push(hash[0]);
  9. vars[hash[0]] = hash[1];
  10. }
  11. return vars;
  12. },
  13. getUrlVar: function(name){
  14. return $.getUrlVars()[name];
  15. }
  16. });

Report this snippet  

You need to login to post a comment.