【发布时间】:2015-02-23 17:33:07
【问题描述】:
在我的 rails 应用程序中使用 jquery_ujs 处理 ajax 表单。我通过调用 ajax:beforeSend 事件更改了要使用 remote: true 发送的表单。如果在我使用 sweetalert 时确认操作执行,我想让它继续执行。
$('.content>.fr span:last-of-type>a').on "ajax:beforeSend", (xhr, settings) ->
swal
title: "Are you sure?"
text: "You will not be able to undo this!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!"
closeOnConfirm: false
, ->
# should send the request here
swal "Deleted!", "Department has been deleted.", "success"
return
要查看它的完整版本,请访问this gist。
【问题讨论】:
标签: jquery ruby-on-rails ajax coffeescript ujs