I have a very simple code example:
$.ajax({
url: 'demo2.htm',
success: function(loadeddata){
$("#loaded_data").html(loadeddata);
alert('success');
},
error: function(){
alert('failure');
}
});
Downloaded data currently returns everything. I need to get only a specific div and make it html #loaded_data.
How to do it?
Thanks!
Edit:
When trying to use .load () ...
Here is what I wrote in the comment.
Thank you, your updated example is wonderful. However, I am not sure with my mistake.
It works
$("#loaded_data").load("demo2.htm #mydiv", function(text, status, request) {
if(status == 'success') {
alert('success');
} else {
alert('error');
}
});
It:
$("#loaded_data").load("demo5.htm #mydiv", function(text, status, request) {
if(status == 'success') {
alert('success');
} else {
alert('error');
}
});
No. He is just hanging. No demo5.htm But the error is not returned.
Thank you very much for your help.
source
share