내가 PHP를 laravel 코딩에서 초보자 도와주세요 해요laravel의 확인 삭제
내가 laravel 5.3을 사용하고 난 사용에 의해 삭제하려면 확인이 이미 저점을 설치 한
을 SweetAlert 만들고 싶어 "npm install"
및 이미 node_modules
폴더에 있습니다.
이 모듈을 사용하려면 다음 질문을해야합니다.
는 기능 등과 같은 준비가 자바 스크립트 함수/**
* Allows you to add data-method="METHOD to links to automatically inject a form
* with the method on click
*
* Example: <a href="{{route('customers.destroy', $customer->id)}}"
* data-method="delete" name="delete_item">Delete</a>
*
* Injects a form with that's fired on click of the link with a DELETE request.
* Good because you don't have to dirty your HTML with delete forms everywhere.
*/
function addDeleteForms() {
$('[data-method]').append(function() {
if (! $(this).find('form').length > 0)
return "\n" +
"<form action='" + $(this).attr('href') + "' method='POST' name='delete_item' style='display:none'>\n" +
" <input type='hidden' name='_method' value='" + $(this).attr('data-method') + "'>\n" +
" <input type='hidden' name='_token' value='" + $('meta[name="_token"]').attr('content') + "'>\n" +
"</form>\n";
else
return "";
})
.removeAttr('href')
.attr('style', 'cursor:pointer;')
.attr('onclick', '$(this).find("form").submit();');
}
예를 들어 elete 버튼에 addDeleteForms 아래 추가 처음
삭제 버튼에 코드를 추가하여 사용 하시겠습니까? – ceejayoz