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.
精彩评论