I have the 'unexpected character error' problem, my Jquery ajax code looks like that:
function test(){
if(true){
$.ajax({
type: 'POST',
url: 'test.php',
dataType: 'json',
data: {
godot: 'godot',
jobadze: 'jobadze'
},
success: function(data){
alert(data);
},
error: function(jqXHR, textStatus, errorThrown) { alert("Error Status: "+textStatus+"\nMessage: "+errorThrown);
}
});
and this is the php code:
<?php
echo 'test';
?>
it should alert "test", but it calls error. What is going on?
dataTypefrom your request