I have an entire html page from html to /html, including script tags, css, etc, stored in a database. I am using jquery to get the variable from a php script based on the id of the row in the database from another website. This all works perfectly but the BODY and HEAD tags are removed - the rest of the html is intact. Can anyone shed some light on this? here is my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
function getListing(postid){
$.ajax({
type: "POST",
url: "http://my-website.com/url.php",
data: postid,
dataType: "html",
cache: false,
success: function(html) {
$("html").html(html);
}
});
}
getListing("postid=6943");
});
</script>
and the php is pretty basic:
<?php header("Access-Control-Allow-Origin: *");?>
<? if($_POST['postid']) {
$postid = $_POST['postid'];
// get html into a variable here *(code romved)*
echo $html;
}
?>