5 months ago

AJAX call not working of safari but working on chrome

Posted 5 months ago by nhayder

I'm using jquery to delete a user logs, My code is working on chrome and i can remove all logs as expected but with safari i'm getting this error

    "message": "CSRF token mismatch.",
    "exception": "Symfony\Component\HttpKernel\Exception\HttpException",
    "file": "/Applications/MAMP/htdocs/app/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
    "line": 208,
    "trace": [

this is my jquery ajax code

        $('#deleteUserLogHistory').on('show.bs.modal', function (event) {

          var button = $(event.relatedTarget)

          var elemID = button.data('id')
          var modal = $(this)


            // delete function

                // get item id
                var id = $(this).val();

                // get token value
                var token = $("meta[name='csrf-token']").attr("content");

                // deleting item
                        url: "/admin/logs/user/delete/"+id,

                        type: 'DELETE',

                        data: {

                            "id": id,

                            "_token": token,


                        success: function (){

                            // reload Page




This is the method on my controller

    public function destroyUserRecords($id)

        if (Gate::denies('activities.delete')) {
            return abort(403);

        $delete = Activity::where('user_id', '=', $id);



Can anyone see a problem with me code, Before safari is not working?

Please sign in or create an account to participate in this conversation.