如何使用JQuery在SWAL中调用success中的函数?
第二个功能不起作用。它没有收到从第一个函数传递的id 这是我的JQuery代码如何使用JQuery在SWAL中调用success中的函数?,jquery,laravel-5,Jquery,Laravel 5,第二个功能不起作用。它没有收到从第一个函数传递的id 这是我的JQuery代码 swal({ title: "Are you sure?", text: "You will not be able to recover this record!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "Yes, d
swal({
title: "Are you sure?",
text: "You will not be able to recover this record!",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (isConfirm) {
// this.$http.delete();
window.axios.post(`/delete-sl-gl/${brcode}/${slc}/${slt}/${sle}/${cts}`)
.then(response => {
// console.log(response.data.sle)
if (response.data.success === true) {
swal('Deleted', response.data.message, 'success');
//console.log(response.data.sle)
spliceSLE_gl(sle.sle);
}
})
.catch(error =>{
console.log(error.response)
});
} else {
swal("Cancelled", "Your file is safe :)", "error");
}
我在拼接sle\u gl(sle.sle)中出错/被忽略实例是一个实例。要根据用户操作添加函数,必须使用then()
方法
这是一个带有链式和链式方法的洼地结构
我把这个接头放在哪里;?这就是我想在SWAL成功后调用的。我编辑了我的答案,以便更清楚地显示在何处添加函数。看一看谢谢,我已经解决了。。我在拼接表行子项时遇到了新问题。。glcontrol=>data1data2cts=>(这是data2内部的子数组)这将不起作用var gl=glcontrol.find(g=>{returng.GLControlSLE_CODE==sle})console.log(gl.cts);var found=glcontrol.cts.find(c=>{return c.GLControlCTS_NUM==cts})如果(found){var index=gl.cts.indexOf(found)gl.cts.splice(index,1)}displayCts(sle)在Louys有任何想法吗?没有想法。。。它看起来不像JavaScript。我已经在Louys解决了它。我错过了游泳的条件。顺便问一下,你有电子邮件吗?这样我就可以直接问你我的代码是否有问题。
swal({
// The swal configuration params
})
// To avoid getting a "cancel" if user click the close button
// or clicks on the overlay (outside the swal)
// "noop" means "no operation".
.catch(swal.noop)
// To handle the confirm/cancel buttons
.then(function (result) {
if (result) {
// Your "confirm" function
}
if (!result) {
// Your "cancel" function
}
});