Can jQuery .load append instead of replace?
I'd probably do it like this.
$('#articles').append($('<div/>', { id: '#articles-page2' });
$('#articles-page2').load('http://example.com/page/2/ #articles > *');
#articles > *
fetches all immediate children to #article
.
You can't append content using the jQuery.load()
method, but you can do what you want using jQuery.get()
:
$.get('/page/2/', function(data){
$(data).find("#articles .story").appendTo("#articles");
});
For appending data, I don't think you would want to use $.load(). Instead, you might want to look into using $.ajax().
$.ajax({
url: 'yourlocation/test.html',
success: function(data) {
$('.result').html(data);
$("#yourdiv").append(data);
}
});