“done()”函数没有在 JS 中触发

时间:2021-06-14 08:58:59

标签: ajax spring-boot post

我正在尝试使用 Thymeleaf 在 Spring Boot 中构建一个应用程序。我需要向服务器发布一些数据,为此我使用了这个 Ajax 代码:

use hex;
...
let message: Vec<u8> = hex::decode("75ca0e2daaf49840ddce9456378efbc95e97ed2566226edca2d73ca1c50450fc")
    .expect("Invalid Hex String");
...
hasher.update(&message);
...

但是 done() 没有触发。相反,它打印了很多行(来自失败回调),这些行是较大数组的一部分,其中有一个字段表示 responseText: {"request":ok}

这是我要发布的功能:

$(".info").on('click', function () {
        var POSTdata = {
            "day": $(this).attr("data-day"),
            "date": $(this).attr("data-date")
        };
        console.log(JSON.stringify(POSTdata));
        $.ajax({
            url: "/shop/select/date",
            type: "POST",
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            data: JSON.stringify(POSTdata),
            success: function(){
                console.log("suc");
            }
        }).done(function () {
            console.log("sss");
        }).fail(error => console.log(error))
    });

0 个答案:

没有答案
相关问题