我需要编写改造查询模拟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>