<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Detect an AJAX Request in&#160;PHP</title> <atom:link href="http://davidwalsh.name/detect-ajax/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/detect-ajax</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Thu, 09 Feb 2012 02:40:12 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: Philip</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-27855</link> <dc:creator>Philip</dc:creator> <pubDate>Thu, 08 Dec 2011 04:35:26 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-27855</guid> <description>The best solution for this would be to just add a parameter say:
&lt;code&gt;
if (isset($_GET[&#039;ajax&#039;]) &amp;&amp; $_GET[&#039;ajax&#039;] == TRUE) {
// Process AJAX request
} else {
// Process non-AJAX request
}
&lt;/code&gt;This should also prevent the cache problem Jason spoke of as using a new URL parameter requires the page to be reprocessed due to the browser being unable to determine what is going on in the server.</description> <content:encoded><![CDATA[<p>The best solution for this would be to just add a parameter say:<br
/> <code><br
/> if (isset($_GET['ajax']) &amp;&amp; $_GET['ajax'] == TRUE) {<br
/> // Process AJAX request<br
/> } else {<br
/> // Process non-AJAX request<br
/> }<br
/> </code></p><p>This should also prevent the cache problem Jason spoke of as using a new URL parameter requires the page to be reprocessed due to the browser being unable to determine what is going on in the server.</p> ]]></content:encoded> </item> <item><title>By: Keilaron</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-26448</link> <dc:creator>Keilaron</dc:creator> <pubDate>Tue, 09 Aug 2011 20:08:52 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-26448</guid> <description>It ain&#039;t an additional layer if that&#039;s the message you respond with. ;)</description> <content:encoded><![CDATA[<p>It ain&#8217;t an additional layer if that&#8217;s the message you respond with. ;)</p> ]]></content:encoded> </item> <item><title>By: Dan "Netwalker" Fernandez</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-26395</link> <dc:creator>Dan "Netwalker" Fernandez</dc:creator> <pubDate>Mon, 08 Aug 2011 10:42:36 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-26395</guid> <description>&quot;This url is an ajax webservice - direct access is denied&quot;. Think of it as an additional layer.Edit: two years later, and for the record</description> <content:encoded><![CDATA[<p>&#8220;This url is an ajax webservice &#8211; direct access is denied&#8221;. Think of it as an additional layer.</p><p>Edit: two years later, and for the record</p> ]]></content:encoded> </item> <item><title>By: mandar</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-25843</link> <dc:creator>mandar</dc:creator> <pubDate>Sat, 09 Jul 2011 04:17:08 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-25843</guid> <description>is there any other way/ method in which i can detect AJAX request?? i need it for security purpose!</description> <content:encoded><![CDATA[<p>is there any other way/ method in which i can detect AJAX request?? i need it for security purpose!</p> ]]></content:encoded> </item> <item><title>By: mandar</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-25842</link> <dc:creator>mandar</dc:creator> <pubDate>Sat, 09 Jul 2011 04:16:46 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-25842</guid> <description>Is there any better method? or different method? which i can use for security?</description> <content:encoded><![CDATA[<p>Is there any better method? or different method? which i can use for security?</p> ]]></content:encoded> </item> <item><title>By: Jos</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-25628</link> <dc:creator>Jos</dc:creator> <pubDate>Mon, 04 Jul 2011 13:55:19 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-25628</guid> <description>You shouldn&#039;t rely on any kind of check for security issues. Using different urls is just as fragile and can be spoofed too. But why at all would you write a security check based on whether a request is an Ajax request or not?</description> <content:encoded><![CDATA[<p>You shouldn&#8217;t rely on any kind of check for security issues. Using different urls is just as fragile and can be spoofed too. But why at all would you write a security check based on whether a request is an Ajax request or not?</p> ]]></content:encoded> </item> <item><title>By: fred</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-23919</link> <dc:creator>fred</dc:creator> <pubDate>Sun, 08 May 2011 06:47:15 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-23919</guid> <description>You could spoof that header remotely. This works fine as a rudimentary check, but shouldn&#039;t be relied on for security purposes.</description> <content:encoded><![CDATA[<p>You could spoof that header remotely. This works fine as a rudimentary check, but shouldn&#8217;t be relied on for security purposes.</p> ]]></content:encoded> </item> <item><title>By: David Walsh</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-23705</link> <dc:creator>David Walsh</dc:creator> <pubDate>Mon, 25 Apr 2011 04:07:57 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-23705</guid> <description>Very true fleh, but the worst thing that can happen, in this example, would be just outputting contentHTML and not the wrapping code.</description> <content:encoded><![CDATA[<p>Very true fleh, but the worst thing that can happen, in this example, would be just outputting contentHTML and not the wrapping code.</p> ]]></content:encoded> </item> <item><title>By: fleh</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-23704</link> <dc:creator>fleh</dc:creator> <pubDate>Mon, 25 Apr 2011 04:03:41 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-23704</guid> <description>Just to make sure everyone&#039;s aware this header can be spoofed from another site or within the certain browser extensions. it&#039;s not an end all be all, it&#039;s just a rudimentary check.</description> <content:encoded><![CDATA[<p>Just to make sure everyone&#8217;s aware this header can be spoofed from another site or within the certain browser extensions. it&#8217;s not an end all be all, it&#8217;s just a rudimentary check.</p> ]]></content:encoded> </item> <item><title>By: Reid</title><link>http://davidwalsh.name/detect-ajax/comment-page-1#comment-16269</link> <dc:creator>Reid</dc:creator> <pubDate>Fri, 26 Feb 2010 18:14:45 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3234#comment-16269</guid> <description>@Fabian:  Gosh, Fabian!  You&#039;re a d-bag, aren&#039;t you?</description> <content:encoded><![CDATA[<p>@Fabian:  Gosh, Fabian!  You&#8217;re a d-bag, aren&#8217;t you?</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 5/22 queries in 0.025 seconds using disk: basic
Object Caching 871/882 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 00:01:57 -->
