I would like to call and execute a segment of PHP code located on an external file. I understand the way of doing that involves jQuery. Here's is my code so far:
<html>
<head>
<title>test</title>
</head>
<body>
<script src="jquery.js"></script>
<script language="javascript" type="text/javascript">
$.post("ext.php", { name: "John", time: "2pm" })
.done(function(data) {
alert("Data Loaded: " + data); });
$(document).ready(function(){
$(this).load('ext.php');});
</script>
</body>
And here is the external file (ext.php):
<?php
echo $_POST['name'] . ' and- ' . $_POST['time'];
?>
The code should print the variables name
and time
on the screen (as well as in the popup window). The popup works fine, but the code doesn't print the veriables on the screen.
Thanks :)