mardi 7 avril 2020

How to use variable inside my Ajax request function in laravel?

I don't know what is going wrong with laravel controller? I want to increment the value of my counter but it is not working.

Code:

public function index(Request $request)

{
  $data=0;

  if($request->ajax())
  {
    $data=$data+1;

    //My Code
  }

  return view('home', compact('data'));

}

result:

Data value : 0



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire