Я внедряю веб-сервис, где я позволяю человеку изменять информацию о еде в моей БД. Когда запрос отправлен и уже обработан, изменения были внесены в БД. Но я получаю эту ошибку! Как мне с этим справиться?
//MODIFYING food
$("button#editFood").click(function(){
var id = $("input#editFoodID").val();
var url = "http://localhost/trial2/webservices/food/update/";
if(id!= "" )
{
url= url + id;
}
alert(url);
//SETTING UP AJAX CALL
$.ajax({
url:url,
accepts: "application/json",
headers:{Accept:"application/json"},
method: "POST",
data:{
editFoodName: $("input#editFoodName").val() ,
editFoodDesc: $("input#editFoodDesc").val() ,
editFoodType: $("input#editFoodType").val(),
editFoodPrice: $("input#editFoodPrice").val()
},
error: function(xhr){
if(xhr.status == 404)
{
$("div#editFoodResult").html("Could not modify food item by this id.
Please try again!");
}//end if
else
{
alert("An error occured: " + xhr.status + " " + xhr.statusText);
} //I get this error
}
})
.done(function(data)
{
$("div#editFoodResult").html("Food details were modified successfully");
});
});