I am trying to display a php file located on a remote server, inside my HTML5 file.
The source code of the PHP file is
<?php
header('Access-Control-Allow-Origin: *');
ini_set('display_errors','On'); error_reporting(E_ALL);
echo " <br><br><br> Testing AJAX ";
?>
And the jQuery and the HTML5 is
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
before DIV
<div id=ajaxinsert> </div>
After DIV
<script>
$document = $(document);
$document.ready(
function( )
{
$ajaxinsert = $("#ajaxinsert");
$ajaxinsert.load("http://englishdigital.net/AJAXTest.php");
}
);
</script>
</body></html>
I am testing this on Google Chrome 38 Desktop. Is the only way to enable it, using a third party plugin? Is it impossible without any plugin? Thanks a lot for your help
Error Message Displayed on the browser console
XMLHttpRequest cannot load http://englishdigital.net/AJAXTest.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Error Message Displayed on the PHP page
Warning: Cannot modify header information - headers already sent by (output started at /home/engli237/public_html/AJAXTest.php:1) in /home/engli237/public_html/AJAXTest.php on line 3
Then what is the solution for this matter? Thanks!