开发者

jquery update class of the same name throughout page

开发者 https://www.devze.com 2023-03-21 10:26 出处:网络
I am trying to do a foreach on class ajax-link so i can load text from an ajax call but the code is only upsating on the first ajax-link on the page. All the others in the page are not being updated.

I am trying to do a foreach on class ajax-link so i can load text from an ajax call but the code is only upsating on the first ajax-link on the page. All the others in the page are not being updated. What am I doing wrong?

    $(document)开发者_如何学JAVA.ready(function(){                   
        $(".ajax-link").each(function(){            
          var href = $(this).attr('href') + '?request=ajax&boo=' + $(this).text(); //URL
          alert(href); // Is It working?
        $(this).load(href); //Create the xmlHttpRequest
     return false; //Stop the HTTP request  
        });                 
    });


return false; will break you out of the each() statement. You need to remove that.

0

精彩评论

暂无评论...
验证码 换一张
取 消