I tried the following:
$.load("Views/chatBox.html").appendTo('body') is not working!
TypeError: $.load is not a function
EDIT:The answer should be only one line of code,that's enough,I think
I tried the following:
$.load("Views/chatBox.html").appendTo('body') is not working!
TypeError: $.load is not a function
EDIT:The answer should be only one line of code,that's enough,I think
Demo:
http://www.crtaci.info/index.php?autocom=majice
Im loading these html files:
http://www.crtaci.info/majice20.html
http://www.crtaci.info/majice40.html
http://www.crtaci.info/majice60.html
Here is the code:
Also this tutorial might help you:
http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/
Here you go:
<script type="text/javascript">
$(function() {
$("body").load("Views/chatBox.html");
});
</script>
I dont understand why placing container at the bottom of body and loading external page into that is not what you need?
What you can try is this:
<script type="text/javascript">
$(function() {
$("#container").load("Views/chatBox.html",function(){
$(this).clone().appendTo("body").remove();
});
});
</script>
But im not 100% sure about this code... :)
When I tried out GaVrA's solution I found it could be even simpler:
<script type="text/javascript">
$(function() {
$("#container").load("external.html").appendTo("body");;
});
</script>
I guess appentTo automatically removes a previous instance? Perhaps I'm missing something here?