Skip to content

Tag: xmlhttprequest

How to check if the request is an AJAX request with PHP

I would like to check server-side if a request to my php page is an ajax request or not. I saw two ways to do this: First way: sending a GET parameter in the request which tells the page that this is an AJAX request (=mypage.php?ajax) mypage.php: Second way: set a header to the xmlHttpRequest: client-side js:…