Reputation: 8348
I am trying to load external website #external-div content to the page on #mydiv div. I have tried by attaching this jquery
<script src="js/jquery-1.8.2.min.js"></script>
and script is
<script>
$(document).ready(function(){
$('#mydiv').load('http://localhost/qa/ask #external-div');
});
</script>
My div
<div id="mydiv">loading...</div>
I have downloaded jquery from here http://jquery.com/download/?rdfrom=http%3A%2F%2Fdocs.jquery.com%2Fmw%2Findex.php%3Ftitle%3DDownloading_jQuery%26redirect%3Dno
But its not loading anything.
Upvotes: 2
Views: 31580
Reputation: 28685
try code bellow to get callback respon:
$('#mydiv').load('http://localhost/qa/ask #external-div', function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
alert(msg + xhr.status + " " + xhr.statusText);
}
});
Upvotes: 3