jquery append external html file into my page jquery append external html file into my page jquery jquery

jquery append external html file into my page


Use html instead of append:

$.get("banner.html", function(data){    $(this).children("div:first").html(data);});


i'm not sure what you're expecting this to refer to in your example.. here's an alternative method:

<html>    <head>        <script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>        <script type="text/javascript">            $(function () {                $.get("banner.html", function (data) {                    $("#appendToThis").append(data);                });            });        </script>    </head>    <body>        <div id="appendToThis"></div>    </body></html>


You can use jquery's load function here.

$("#your_element_id").load("file_name.html");

If you need more info, here is the link.