I have this ajax request:
$.ajax({
type: 'POST',
url: 'contactUsInsertBoat.php',
data: {
name: $insertBoatForm.find( 'input[name=name]' ).val(),
phone: $insertBoatForm.find( 'input[name=phone]' ).val(),
email: $insertBoatForm.find( 'input[name=email]' ).val(),
},
success:function(data){
// successful request;
var json_obj=JSON.parse(data);
var $insertBoatContent = $( '#insert-boat-content' );
$insertBoatContent.addClass("center");
if (json_obj["response"] == true) {
$insertBoatContent.html( "<br/><h4>Richiesta inviata con successo</h4>" );
} else {
$insertBoatContent.html( "<br/><h4>Richiesta non inviata</h4>" );
}
},
error:function(){
// failed request; give feedback to user
$('#ajax-panel').html('<p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>');
}
});
In contactUsInsertBoat.php
I do this:
include 'functions.php';
require_once 'BusinessLogic/Manager.php';
use BusinessLogic\Manager;
sec_session_start();
if(isset($_POST['name'])){
Manager::contactInsertBoats($_POST['name'],$_POST['email'],$_POST['phone']);
$arrResult = array ('response'=>true);
echo json_encode($arrResult);
}else{
$arrResult = array ('response'=>false);
echo json_encode($arrResult);
}
But after that I do this firebug console writes:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
var json_obj=JSON.parse(data);
and the content of JSON is:
<br />
<b>Strict Standards</b>: Non-static method BusinessLogic\Manager::sendMail() should not be called statically in <b>/var/www/public/BusinessLogic/Manager.php</b> on line <b>1957</b><br />
{"response":true}
Why is it adding the strict standards log to JSON object?