0

我想在自动生成的 Sweet Alert2.Ajax 响应上显示 Ajax 响应,这可能是确认按钮或只是信息消息的一些问题。我想显示与我在 Ajax 上收到的完全相同的内容。有人知道我如何实现它吗?问候。

   success: function (result) {
       swal({
            html:true,
            title: title,
            type: type,
            text:  $(result).find('html'),
            confirmButtonColor: "#33537d",
            confirmButtonText: "Close",
            closeOnConfirm: false
        },
4

1 回答 1

0

嗨,您应该能够像这样在甜蜜警报中使用响应数据。

$.ajax({
    type: "POST",
    url: "YourPhpFile.php",
    data: { 'dataString': dataString },
    cache: false,
    success: function(data) {
        var responseData = "data : " + data;
        swal(
        html:true,
        title: title,
        type: type,
        text:  responseData,
        confirmButtonColor: "#33537d",
        confirmButtonText: "Close",
        closeOnConfirm: false
        )
    }
});

祝你好运。

于 2017-10-21T04:26:22.413 回答