Мне нужно написать запрос на модифицированный аналог AJAX-запроса. Я пытаюсь добавить заголовок JSON и / или FormUrlEncoded не работает, может быть, мы можем помочь мне!
$.ajax({
url: "index.php",
type: "DELETE",
dataType: 'json',
data: JSON.stringify({id: product_id, action: "REPORT"}),
success: function (result) {
// re-load list of products
showProducts();
},
error: function (xhr, resp, text) {
console.log(xhr, resp, text);
}
});
@FormUrlEncoded
@HTTP(method = "DELETE", path = "api", hasBody = true)
@Headers("Content-Type: application/json")
fun deleteReport(@Field("action") action: String = "REPORT", @Field("id") id: Int): Call<ResponseBody>