I have a statement in my code like this
return response()->json([
'error'=>$validator->errors()->all()
]);
When I view the response it has curly braces around it and looks like an object and it throws an error in the console that says
SyntaxError: Unexpected end of JSON input at parse ()
What do I need to change to get the format that my ajax call can interpret?
This code worked inside of a controller but when I move it to a different page it breaks so it seems there is something in the controller that corrects this, but is missing on my own page. Any ideas?