XMLHttpRequest
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
XMLHttpRequest
How can I check if a request has been made via jQuery for an AJAX request...
The XMLHttpRequest is what is used on the client side and I assume that objects sets some special headers before submittion to server side script. If this is the case, then is there a way to parse the HTTP headers and determine if the request was made via XMLHttpRequest so I can handle that situation in my PHP code?
The XMLHttpRequest is what is used on the client side and I assume that objects sets some special headers before submittion to server side script. If this is the case, then is there a way to parse the HTTP headers and determine if the request was made via XMLHttpRequest so I can handle that situation in my PHP code?
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Hockey wrote:Look into Zend Http request...volka wrote:Mind to share?
Code: Select all
$_SERVER ['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';Ah ok, and that works because e.g. Prototype sets this http header
prototype.js wrote:Code: Select all
setRequestHeaders: function() { var headers = { 'X-Requested-With': 'XMLHttpRequest', 'X-Prototype-Version': Prototype.Version, 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' };
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg