[英]If it's possible to display Ajax response ( html page ) on SweetAlert2?
我想在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
},
嗨,您应该只能够在这样的甜蜜警报中使用响应数据。
$.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
)
}
});
祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.