Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to pass token in laravel in jquery ajax

<script>
 $(document).ready(function() {
    $(document).on('click', '#ajax', function () {
      $.ajax({
         type:'POST',
         url:'/ajax',
         headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
         success:function(data){
            $("#msg").html(data.msg);
         }
      });
    });
});
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #token #laravel #jquery #ajax
ADD COMMENT
Topic
Name
8+3 =