I googled this question and I couldn’t find an answer.
I have a page generated by PHP that generates a JSON string that I use javascript/jQuery/AJAX to retrieve it.
I would like to have a message appear if a user opens this backend page directly by PHP but if retrieved by AJAX it still work as normal.
Is this possible in PHP and what would I be looking at to do this?
Sure, just check the headers to see how it was requested:
Just check to make sure your server supports
HTTP_X_REQUESTED_WITH. Not all do, though off the top of my head I know Apache 2 does.