pass data from ajax to controller in laravel

Posted 2 years ago by massum

i am having a problem in sending ajax get request to fetch the data in to the controller. what i am trying to achieve is the data i am sending through ajax i should be able to access those data and send it to another view. i am sharing my code below plz help javascript

              url: 'roombooking',
              type: "get",
              data: {id:data},
               success: function(response){ // What to do if we succeed
              if(data == "success")
route file
Route::post('roombooking','[email protected]');
controller file
public function roombooking(request $request)
     //return 'success';
      $data= $request->dataval;
      return $data;
     // return view ('pages.roombooking') ;
      //return View::make('pages.roombooking')-with(compact('success'));
      //return view('pages.roombooking');


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

Reply to

Use Markdown with GitHub-flavored code blocks.