Skip to content

Instantly share code, notes, and snippets.

@mahammad
Last active March 17, 2023 11:17
Show Gist options
  • Save mahammad/e59403df8b4f908316fc77533fd2b05b to your computer and use it in GitHub Desktop.
Save mahammad/e59403df8b4f908316fc77533fd2b05b to your computer and use it in GitHub Desktop.
<script type="text/javascript">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$('form').on('submit',function(e){
e.preventDefault();
$.ajax({
type:'POST',
url:'', // endpoint {{ route('test') }}
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
// data key valular
},
success:function(data){
alert(data.success);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment