Chartjs-Ajax call to trigger a controller function

0👍

Please try using the following structure for your ajax request:

  $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
  $.ajax({
            url: "/map",
            type: 'POST',
            data: {},
            success: function (data) {    
                console.log("AJAX END");
            }
        });

And maybe there is just a problem with your debug "<script>console.log('NewChart funtion called');</script>" but everything is working fine. Just try to use the data that is returned.

success: function (data) {    
                $('#someDiv').html(data);
            }

Leave a comment