Answers for "how to check request data in laravel ajax request"

2

laravel check request is ajax

/**       
         * Display a listing of the resource.
         *
         * @param  Illuminate\Http\Request $request
         * @return Response
         */
        public function index(Request $request)
        {
            if($request->ajax()){
                return "AJAX";
            }
            return "HTTP";
        }
Posted by: Guest on September-07-2020
0

ajax laravel get data

$.ajaxSetup({
        headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
    });
    jQuery.ajax({
        url:'/group/create',
        type: 'GET',
        data: {
            name: groupName,
            colour: "red"
        },
        success: function( data ){

            console.log(data);
        },
        error: function (xhr, b, c) {
            console.log("xhr=" + xhr + " b=" + b + " c=" + c);
        }
    });
Posted by: Guest on March-26-2020

Code answers related to "how to check request data in laravel ajax request"

Code answers related to "Javascript"

Browse Popular Code Answers by Language