Not Able To Detect AJAX Request.

Discussion in 'PHP' started by kajol, Apr 14, 2010.

  1. #1
    Hi,

    I am using $_SERVER['HTTP_X_REQUESTED_WITH'] to detect if the request is coming from an AJAX page, but the above server variable is not available.

    Where is the problem...?

    Thanks in advance.
     
    kajol, Apr 14, 2010 IP
  2. UniversalProgramming.com

    UniversalProgramming.com Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You won't know where it's coming from.
    All you can detect it the referring page, using $_SERVER['HTTP_REFERRER'];
     
  3. frank100

    frank100 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    may be same tutorial you are using also say
    $_SERVER['HTTP_X_REQUESTED_WITH'] is the golden ticket but not all servers provide this variable so having other checks in place will be important.
     
    frank100, Apr 17, 2010 IP