Most well-known Ajax frameworks like jQuery and mooTools add a specific header which you can check with PHP:
if (strcasecmp('XMLHttpRequest', $_SERVER['HTTP_X_REQUESTED_WITH']) === 0)
{
// Ajax Request
}
More Related Contents:
- Call php function from JavaScript
- jQuery AJAX form using mail() PHP script sends email, but POST data from HTML form is undefined
- How to keep form values after post [duplicate]
- html graphs from database [closed]
- Submit a form using Shift + Enter [duplicate]
- check if link “still” exists [duplicate]
- Is the following code valid? [closed]
- Submit form without page reloading
- Send JavaScript variable to PHP variable [duplicate]
- Keep values selected after form submission
- How to avoid echoing character 65279 in php?
- How do I run PHP code when a user clicks on a link?
- Resize iframe height according to content height in it
- Change DIV content using ajax, php and jQuery
- First drop down menu to auto change the options of a second dropdown
- Execute javascript in PHP
- How to load PHP file into DIV by jQuery?
- Populate another select dropdown from database based on dropdown selection
- How to preview an image before and after upload?
- Get variable from PHP file using JQuery/AJAX
- Who Add “_” Single Underscore Query Parameter?
- How to save webpage as a image file using PHP?
- How to replace html element with ajax response?
- Jquery: Running AJAX locally without a webserver
- Multiple javascript/css files: best practices?
- How can I pass variables from JavaScript to PHP?
- How to download a file on clicking the name of file using PHP?
- How to implement a chat room using Jquery/PHP?
- How to handle newlines in Javascript? (from PHP)
- How can you use php in a javascript function [duplicate]