The code on my php:
<html>
<script src="jquery2_3.js"></script>
<script>
function ajax(){
$.ajax({
type: 'POST',
url: 'mypage.php',
data: {test: 'asdf'},
success: function(){
alert('done');
}
});
}
</script>
</html>
<?php
foreach ($_GET as $key => $value) {
echo "<tr>";
echo "<td>";
echo $key;
echo "</td>";
echo "<td>";
echo $value;
echo "</td>";
echo "</tr>";
}
?>
When I use PostMan (Chrome app REST Client) I can submit GET variables and get the expected results echoed on the page.
When I open this page in Chrome and run the ajax method via js console, I get the alert message, but nothing echoed from the php script or any changes on the page.
I have tried using using the jquery get() and post() methods both which indicated success but no results displayed. But the php code runs fine when I send the requests through Postman.
Jquery gives me no errors, any ideas? Thanks