-
-
Notifications
You must be signed in to change notification settings - Fork 363
Description
I am working on a project where I need to use html/javascript and I only want to interact with the API via ajax/json calls from a different server. I also don't want to heavily modify the default Userfrosting install and want to keep the bootstrap theme for administration on the server-side.
So if I access "load_current_user.php" from a browser, addAlert() and apiReturnError() will send client to login.php or their default page through a 302 re-direct. How can I maintain this functionality but optionally send back a json_encode() error to client when the request is made from AJAX call? How can the error handle function differentiate between the requests.
I thought of just calling a different php file, ex: load_current_user.php vs load_current_user_ajax.php, but that seems like to much extra work to do this for the whole API.