I want to see the return value of each line of code in an ajax function. The below code gives me error 1 and e. Now I want to check exactly what is causing the error by printing the return value of each line of the function. Here's the code:
<script type="text/javascript">
function editTitleModalSubmit(titleId) {
console.log("1");
event.preventDefault();
$.ajax({
url: 'functions/administration-functions.php',
type: 'POST',
data: { "title": $('#editadminTitle').val(), "units": $('#editadminUnits').val(), "category": $('#editadminCategory').val(), "titleId": $('#adminTitleId').val(), "typeId": $('#adminTypeId').val() },
dataType: "json",
success: function() {
$('#adminForm').trigger('reset');
resultAlert('#adminResult', '#resultAdminContent', '<strong>You data was succefully saved!</strong>', 'alert-success');
},
error: function() {
console.log("e");
}
});
}
</script>
administration-functions.php
<?php
require_once './queries.php';
$title = filter_input(INPUT_POST, "title");
$units = filter_input(INPUT_POST, "units");
$category = filter_input(INPUT_POST, "category");
$typeId = filter_input(INPUT_POST, "typeId");
$titleId = filter_input(INPUT_POST, "titleId");
echo Queries::editTitle($title, $units, $category, $titleId, $typeId);
?>