Load external page into article with JQuery
Hi all,
I've been reading numerous of posts of using JQuery to load an external URL into a page. I tried many solutions but till now nothing has worked for me. I'm new to JQuery and would love to know how I can make this happen. The code I've implemented now is:
<
script
type
=
"text/javascript"
src
=
"<?php echo $templateUrl; ?>/script.js"
>
</
script
>
<script type="text/javascript">
$(document).ready(function(){
$('#test').load('http://www.test.com', '', function(response, status, xhr) {
if (status == 'error') {
var msg = "Ërror!: ";
$(".content").html(msg + xhr.status + " " + xhr. statusText);
}
});
});
</script>
Placed in <head> section
<div id="test"></div> in <body>
How can I make this work?
Thanks in advance!