I want users to be able to include my php file and load content from the file into some class.
For example, say the user has this file:
user.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="myfile.php?width=100&height=100">
</script>
</head>
<body>
<div class="my-class">
</div>
</body>
</html>
and I want to show the contents from myfile.php in .my-class :
<?php
$width = $_GET['width'];
$height = $_GET['height'];
echo "$('.my-class').load('load_content.php?width=$width&height=$height')";
?>
and into load_content.phpsomething simple:
<?php
echo $_GET['width'] + $_GET['height'];
?>
I cannot find a similar question anywhere, I tried something, but only that I was able to do document.write something on user.html from myfile.php, but when I tried to load something or use innerHTML I get a blank page.
source
share