I have laravel crud store with $data for request input and $data2 to paste the input. I tried return redirect, return redirect back, return with with no avail. I tried with :
return view('myView', ["data" => $data2]);
My page "myView" have $data2 for result that I want. But everytime I reload the page it will submit another entry to database. Anyone here know what should I do? Prefent reload page or change return on submit method in my controller?
CodePudding user response:
After you submit value, then return response something like this:
return response()->json(['code'=>200, 'message'=>'Post Created successfully','data' => $data2], 200);
If you use ajax then the response is JSON.
