So I have searched the forum for similar questions unfortunately I have been unlucky to find an answer that suits my problem. I am trying to make an ajax call in my jquery using the following code;
function submitForm(formData)
    {
    $.ajax({
        type: 'POST',
        url: 'addEvents.php',
        data: formData,
        dataType:'json',
        cache:false,
        timeout:7000,
        success: function(data){
            $('#addEventsForm #response').removeClass().addClass((data.error === true) ? 'error' : 'success').html(data.msg).fadeIn('fast');
            if($('#addEventsForm #response').hasClass('success')){
                setTimeout("$('#addEventsForm')",5000);
            }
        },
        error:function(XHR,textStatus,errorThrown)
        {
            $('#addEventsForm #response').removeClass().addClass('error').html('<p> There was an <strong>' + errorThrown +
                '</strong> error due to <strong>'+ textStatus +'</strong> condition.</p>').fadeIn('fast');
            console.log(arguments);
        //alert(XMLHttpRequest.responseText);
        },
        complete:function(XHR,status)
        {
            $('#addEventsForm')[0].reset();
        }
    });
}
But I am getting a sysntax error. I have tried doing this to see what errors I get in chrome
console.log(arguments);
but the responseText in the [Object, "parsererror" , SyntaxError] node seems to display the entire html of the page that contains the form where I am inserting the record.
I am still getting my feet wet in ajax so I am not yet a pro in absolutely understanding the error messages and what they mean.
 
     
     
    
", $events->errors); $return['error'] = true; $return['msg'] = "The event upload failed because".$error_message.$message; echo json_encode($return); }` – mistaFloss Aug 23 '14 at 17:24