On Tuesday, October 31, 2006 10:46 AM Luke Lutman <> said:

> Have a look at this recent thread :-)
>
http://www.nabble.com/method-plugin-for-getting-query-string-vars--tf248
1232.html#a6919130

I read through this and tried to implement your first suggestion but I
notice that everything takes location.search and parses that. I want to
use it in the following way:

theHref = $(this).attr("href").query();

Your function is:

jQuery.query = function() {
        var r = {};
        var q = location.search;
        q = q.replace(/^\?/,''); // remove the leading ?
        q = q.replace(/\&$/,''); // remove the trailing &
        jQuery.each(q.split('&'), function(){
                var key = this.split('=')[0];
                var val = this.split('=')[1];
                // convert floats
                if(/^[0-9.]+$/.test(val))
                        val = parseFloat(val);
                // ingnore empty values
                if(val)
                        r[key] = val;
        });
        return r;
};

I'm not sure how to modify that function to do what I want (considering
my current lack of JS/jQuery syntax). Would you mind showing me what to
do?


Thank you,
Chris.

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to