ajax call or no ajax call


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



Copy this code and paste it in your HTML
  1. /**
  2.  * Returns true if the request comes from an ajax call
  3.  *
  4.  * @return bool
  5.  * @author Robert Agthe
  6.  */
  7. function is_ajax()
  8. {
  9. return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')?true:false;
  10. }
  11.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.