I have some very simple sample code like this:
$.ajax({
url: 'demo2.htm',
success: function(loadeddata){
$("#loaded_data").html(loadeddata);
alert('success');
},
error: function(){
alert('failure');
}
});
Loaded data currently returns everything. What I need to is to get only a specific div and make it the html of #loaded_data.
How do I do that?
Thanks!
Edit:
While trying to use .load()...
Here's what I wrote into the comment.
Thanks, your updated example is great. However I'm not sure what's wrong with mine.
This: works
$("#loaded_data").load("demo2.htm #mydiv", function(text, status, request) {
if(status == 'success') {
alert('success');
} else {
alert('error');
}
});
This:
$("#loaded_data").load("demo5.htm #mydiv", function(text, status, request) {
if(status == 'success') {
alert('success');
} else {
alert('error');
}
});
Does not. It just hangs. There is no demo5.htm But no error is returned.
Thanks a lot again for all of your help.