开发者

jquery update class of the same name throughout page

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜