mardi 29 janvier 2019

jQuery.ajaxSetup is not a function

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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire