jQuery: How to get parameters of a url?
问题 New to jQuery and I'm having trouble getting the parameters of a url that my server generates. I have a url like this: <span class="popuptest"><a href="www.example.com/test?param1=1¶m2=2">find param</a></span> my jquery function looks like so: $(function() { $('.popuptest a').live('click', function(event) { $.extend({ getUrlVars: function(){ var vars = [], hash; var hashes = this.href.slice(this.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i]