jQuery Ajax load a certain div only?
Hi can someone help me how to specify in the first example that i want processing only a certian DIV like i can do with the "load" method insteasd of "ajax" long version? thank you
// WITH EXTENDED VERSION, how to specify a div to be proce开发者_如何转开发ssed?
$.ajax({
url: 'ajax/test.html',
success: function(data) {
$('#current-div').html(data);
alert('Load was performed.');
}
});
// WITH LOAD, it's ok|
$("a").click(function() {
var myUrl = $(this).attr("href") + " #external-div";
$("#current-div").load(myUrl);
return false;
});
I think that what you're after is this?
$('#current-div').load('ajax/test.html');
alert('Load was performed.');
精彩评论