2
jquery_ujs를 사용하여 레일 애플리케이션에서 아약스 양식을 처리합니다. 필자는 ajax : beforeSend 이벤트를 사용하여 remote와 함께 보낼 양식을 변경했다. 나는 그것의 전체 버전을 보려면ajax로 변경 한 후 ajax 요청을 계속 진행하십시오. beforeSend
$('.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
sweetalert를 사용할 때 나는 this gist에, 그것은 작업의 실행이 확인이 경우 실행을 계속하기 위해 같은 것입니다.
내 두 번째 레일 프로젝트에서 지금은 레일에서 개발 해본 적이 있기 때문에 아약스조차 시도하지 않았습니다. 나는 UJS'remote : true' 만 사용한다. –