Your Source for Web Development Resources

Your Source for Web Development Resources

Detect an Ajax Request in PHP

I like using the same PHP script for both AJAX and non-AJAX content requests. Using one script just makes everything easier because it’s only one file to update/edit and it’s one more cache-able request. One way to try detect an AJAX request (as opposed to a regular page load) is by using the following PHP code.

Choose It

Choose It

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.