jquery - getting multiple attributes from a link before sending to a .load query -
the code below supposed grab ?cs=bla&cat=bla values link attribute , post .load query...does know going wrong?
//remove tab info , add gallery $(".more").click(function () { var $gallery = $(this).closest('.tab').find('.gallery-holder'), cat = $(this).attr('href').split('cat=')[1]; if ($gallery.is(':empty')) { $gallery.load('/public/themes/lbd/js/imagegallery.php', {'cat': cat}, function(){ $(this).fadein(function(){ $('a.customgal').zoomimage(); }); }); } $gallery.siblings().fadeout(function(){ $gallery.fadein(); }); return false; });
where approach goes wrong split, when this: .split('cs=')
, you're not getting "bla"
result, you're getting "bla&cat=bla"
, rest of string.
you pass data same string if it's in known format (the original querystring pairs), this:
var data = this.href.split('?').pop(); if ($gallery.is(':empty')) { $gallery.load('/public/themes/lbd/js/imagegallery.php', data, function() { $(this).fadein(function() { $('a.customgal').zoomimage(); }); }); }
note produce request rather post (which happens .load()
gets object data
argument).
Comments
Post a Comment