I want to pass data from control file to js file with laravel and ajax, I have tried but I got error all time, How can I pass just one value or array. In this example I have email, name and country in users table.
Code Here.
Control file:
public function showData(Request $request)
{
$userid = User::find($request['userId']);
$user = DB::table('users')->where('id', '=', $userid )->first();
return response(.....);
}
JS file:
.done(function() {
// pass data or do something . . .
});
Should I use .done or success ? which better ?