Wednesday, 16 January 2013
How to know request is ajax or other in php
How to know whether the request is an ajax request or normal request in PHP?
We can know it through following code:
$ajax
=
false
;
if
(
!
empty
(
$_SERVER
[
'HTTP_X_
REQUESTED_WITH'
]
)
&&
strtolowe
r
(
$_SERVER
[
'HTTP_X_REQUESTED_
WITH'
]
)
==
'xmlhttprequest'
)
{
$ajax
=
true
;
}
echo $ajax;
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment