Catching an Array from AngularJs using laravel Contoller

Viewed 46

Hi I am new to Laravel and Angularjs I am trying to send an array from angularjs to laravel controller i am not getting any errors but I have problem catching data in laravel controller and using the data Here the Angular code

 $scope.sendSetField = function (selected_list) {       
        var arr = [];
        angular.forEach(selected_list, function(value, key){
            arr.push(key);
        });
        console.log(arr);
        $http.post("http://localhost/maxo_ats_v1.00/dashboard/jobsDownload", 
         arr).then(function (d̶a̶t̶a̶,̶ ̶s̶t̶a̶t̶u̶s̶,̶ ̶h̶e̶a̶d̶e̶r̶s̶,̶ ̶c̶o̶n̶f̶i̶g̶ response) { 
         alert("success"); 
        },function (d̶a̶t̶a̶,̶ ̶s̶t̶a̶t̶u̶s̶,̶ ̶h̶e̶a̶d̶e̶r̶s̶,̶ ̶c̶o̶n̶f̶i̶g̶ response) { 
            alert("error"); 
        });
   };

I can able to print the data in console successfully.But failing to print data using laravel controller

My controller

 public function downloadJobsList(Request $request)
 {
    $jobs = request('arr');
    dd($jobs);        
 }

Route:

Route::post('dashboard/jobsDownload','JobsController@downloadJobsList');
1 Answers
Related