JavaScript:在div中加载包含PHP函数的文件

I have this situation.

file.html

.......
<div id="mydiv">
</div>
.......

myjsfile.js

............
$("#mydiv").load("myphpfile.html");
............

myphpfile.html

............
<?php
    include("myfile.php");
?>
............

The content of myphpfile.php is not viewed. How can I show the content of myphpfile.php in selected div?

Thanks.

You can use php also in load funtion.

$(document).ready(function(e) {
         $("#mydiv").load("myfile.php");
});

Above code will load after page loaded

include("myfile.php");

include function will run before loading html and javascript codes..

Use this script file for library jquery-1.9.1.js

We could not able to include PHP file with in HTML file. You have to call php file instead of HTML file. In PHP, there are many function to include Myfile.php file. please find the include function as below:

include()

require()

include_once()

require_once()