I have this AJAX call:
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url:'test.php',
type:'GET',
datatype: "json",
success:function(data)
{
alert(data);
},
error:function()
{
alert("error");
}
});
});
</script>
and my test.php contains this:
<?php
echo json_encode("pepperoni pizza");
exit;
?>
However, my alert ends up showing all the PHP code instead of just "pepperoni pizza"
I have looked around quite a bit but haven't found a post that completely solves my problem. Thanks in advance for any tips!