detect if ajax or json request


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function is_ajax()
  2. {
  3. return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) AND
  4. strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.