【发布时间】:2023-01-20 06:46:29
【问题描述】:
我正在尝试将 sweetAlert2 用于我的 ajax,在内部创建一个表单,然后执行它的过程并取回结果,但我被困在一个点上,即当我发送结果时,我如何处理其中的 ajax,
这是我现在的代码
Swal.fire({
title: 'Request PlayForm',
html: `<textarea name="da" id="da"></textarea>`,
confirmButtonText: 'Submit',
focusConfirm: false,
preConfirm: () => {
const textData = Swal.getPopup().querySelector('#da').value
if (da== '') {
Swal.showValidationMessage(`Please enter details.`)
}
return { da: da}
}
}).then((result) => {
Swal.fire(`
Email Sent Successfully -- this message should come when i get a success from my ajax else it will display error which i can get from ajax
`.trim())
})
【问题讨论】:
标签: javascript jquery sweetalert2