Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

laravel ajax post data to controller

 $.ajax({
            url: "/route/to",
            type: 'POST',
            beforeSend: function (request) {
                return request.setRequestHeader('X-CSRF-Token', $("meta[name='csrf-token']").attr('content'));
            },
            success: data => {
                console.log(data);
            }
        });
 
PREVIOUS NEXT
Tagged: #laravel #ajax #post #data #controller
ADD COMMENT
Topic
Name
3+6 =