Upload the contents of the external div to my div page

I am trying to upload the contents of the external site # external-div to the page #mydiv div. I tried linking this jQuery

<script src="js/jquery-1.8.2.min.js"></script>

and the script is

 <script> $(document).ready(function(){ $('#mydiv').load('http://localhost/qa/ask #external-div'); }); </script> 

My div

<div id="mydiv">loading...</div>

I downloaded jquery from here http://jquery.com/download/?rdfrom=http%3A%2F%2Fdocs.jquery.com%2Fmw%2Findex.php%3Ftitle%3DDownloading_jQuery%26redirect%3Dno

But it does not load anything.

+2
jquery external load
Oct 17 '12 at 15:56
source share
1 answer

try the code below to get a response:

 $('#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); } }); 
+2
Oct 17
source share



All Articles