I have a small problem with JQuery .load that´s driving me nuts - I am quite sure it is simple, but I have been staring at it for too long now :)
I have the following in a .ready(function() {
$('.content_s').load('url/path/aspxpage?dataid='+$(this).attr('data'));
and 1 or more .content_s classed div with a data="data" section, but I cannot get the data attr - i just get undefined, regardless of the number of divs or what I set as data. The aspxpage gets called alright, just not with the data attr.
As mentioned, I think I have stared myself blind on this, so any suggestions would be most welcome.
Regards
You need to use .each in such case:
$('.content_s').each(function() {
var $this = $(this);
$this.load('url/path/aspxpage?dataid='+$this.attr('data'));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With