How to implement checks for isAjax http request?

Hi guys. I need to check whether the request came via ajax. In Google I found only the option to add a header on client-side then to check it out but for obvious reasons I cannot do that.
July 2nd 19 at 16:54
2 answers
July 2nd 19 at 16:56
And you have much choice there, only the header X-Requested-With: XMLHttpRequest and can be determined. Of course, the client, a hacker may cheat you by sending this header in some curl-ohms, for example. But most "honest" js-library uses it as standard for almost 10 years.
Thank you. Let them cheat I just need to know to return json or renditi the page on the server. - Jeanette_Zboncak14 commented on July 2nd 19 at 16:59
July 2nd 19 at 16:58

Find more questions by tags AJAXComputer networks