my code is On head
<meta name="csrf-token" content="" />
On form
<input type="hidden" name="_token" value="">
Script
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(e) {
jQuery.ajaxSetup({
headers: {
'X-CSRF-TOKEN': jQuery('meta[name="csrf-token"]').attr('content')
}
});
});
jQuery('form').on('submit', function(e) {
var msg = jQuery('#msg').val();
e.preventDefault();
jQuery.ajax({
type: 'post',
url: '/sendmsg',
data: jQuery('#send-msg').serialize(),
success: function() {
alert('form was submitted');
}
});
});
</script>
Error is jQuery.ajaxSetup is not a function
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2MIr9Wo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire