The issue I'm having is that when I'm attempting to post to a PHP page it will just return the entire PHP document and not the things being echoed.
<script type="text/javascript">
$.ajax({ type:"POST",
url:"backMap/locationCreation.php",
data: { name: "TEMP" },
success: function(data) { $("#awesomet").html(data);},
error: function(xhr, textStatus, thrownError, data) {
alert("Error: " + thrownError);
}
});
</script>
<div id="awesomet">Not showing.</div>
With this I am trying to send an Ajax Post to the given URL. I am giving it some data and if it returns successfully then it will put it's data within the div.
<?php
if (isset($_GET['name'])) {
echo "Asked for name!";
}
for ($i = 1; $i <= 10; $i++) {
echo '<p>For loop! Value: ' . $i . ' of 10.</p>';
}
?>
When I call this I receive the entire php page as a result.
I literally get the whole page, if statements, for loop and all. Including the <?php
flags. I don't understand why I'm receiving the data like this.
I am running this through Phonegap.
Any help is appreciated.