How to get variable from server and write to the global variable?

Hi all.
There is such here a method in laravel:
public function ifAdmin()
{
if(Auth::check()){
 $auth = Auth::user()->email;
 $role = Role::where([
['email',$auth],
['role_name','admin']
])->get();

 return response()->json($role);
}
 }


How to get and write to the window object?
June 3rd 19 at 21:05
1 answer
June 3rd 19 at 21:07
Solution
Make xhr request to this method and put the answer in the window?
5b4f9af2c9b70260665542.png
Here's how I'm doing. How can I display data from that object? - humberto.Wuckert18 commented on June 3rd 19 at 21:10
, to bring? - sofia.Maggio commented on June 3rd 19 at 21:13
on the screen - humberto.Wuckert18 commented on June 3rd 19 at 21:16
5b4f9d82c7d77963485433.png

Here is what the response from the server - humberto.Wuckert18 commented on June 3rd 19 at 21:19
well... Ways to hang out a lot. Can the alert bring, can in a certain unit to bring the old... - sofia.Maggio commented on June 3rd 19 at 21:22

Find more questions by tags JavaScriptLaravel