Load external div content to my page div

30,191

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);
      }
});
Share:
30,191
Code Lover
Author by

Code Lover

Updated on October 18, 2020

Comments

  • Code Lover
    Code Lover over 3 years

    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.

  • Code Lover
    Code Lover over 11 years
    I have placed after my js and same error like GET http://localhost/qa/ask 200 OK 108ms but nothing loads