改装中的模拟Ajax请求

时间:2019-07-03 10:11:30

标签: android retrofit2

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

0 个答案:

没有答案