<?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/"
		>
<channel>
	<title>Comments on: Detect AJAX Requests using the x-requested-with header and xmlhttprequest</title>
	<atom:link href="http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/</link>
	<description>Web Design &#38; Development Blog</description>
	<lastBuildDate>Sat, 04 Feb 2012 19:06:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: kn33ch41</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-7543</link>
		<dc:creator>kn33ch41</dc:creator>
		<pubDate>Sun, 13 Mar 2011 00:56:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-7543</guid>
		<description>@Rob

The second condition takes care of that. If the variable passed to strtolower() is empty it certainly will not equal xmlhttprequest, which means the whole statement will return false. I know you&#039;re doing it that way to avoid throwing a notice, but this would then be a good time to use the @-operator. 

strtolower(@$_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;]) == &#039;xmlhttprequest&#039;</description>
		<content:encoded><![CDATA[<p>@Rob</p>
<p>The second condition takes care of that. If the variable passed to strtolower() is empty it certainly will not equal xmlhttprequest, which means the whole statement will return false. I know you&#8217;re doing it that way to avoid throwing a notice, but this would then be a good time to use the @-operator. </p>
<p>strtolower(@$_SERVER['HTTP_X_REQUESTED_WITH']) == &#8216;xmlhttprequest&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alison Harper</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-5716</link>
		<dc:creator>Alison Harper</dc:creator>
		<pubDate>Tue, 18 Jan 2011 06:27:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-5716</guid>
		<description>Nice website and a cool trick</description>
		<content:encoded><![CDATA[<p>Nice website and a cool trick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-5338</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Tue, 04 Jan 2011 19:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-5338</guid>
		<description>&lt;a href=&quot;#comment-5304&quot; rel=&quot;nofollow&quot;&gt;@kn33ch41 &lt;/a&gt; 

I&#039;d personally say it&#039;s needed as HTTP_X_REQUESTED_WITH may not always be available and could create errors.</description>
		<content:encoded><![CDATA[<p><a href="#comment-5304" rel="nofollow">@kn33ch41 </a> </p>
<p>I&#8217;d personally say it&#8217;s needed as HTTP_X_REQUESTED_WITH may not always be available and could create errors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kn33ch41</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-5304</link>
		<dc:creator>kn33ch41</dc:creator>
		<pubDate>Tue, 04 Jan 2011 03:54:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-5304</guid>
		<description>isset($_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;])  is unnecessary. You might as well make the code shorter.</description>
		<content:encoded><![CDATA[<p>isset($_SERVER['HTTP_X_REQUESTED_WITH'])  is unnecessary. You might as well make the code shorter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-3348</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Wed, 29 Sep 2010 13:55:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-3348</guid>
		<description>&lt;a href=&quot;#comment-3171&quot; rel=&quot;nofollow&quot;&gt;@Rob &lt;/a&gt; Thanks :) You too.</description>
		<content:encoded><![CDATA[<p><a href="#comment-3171" rel="nofollow">@Rob </a> Thanks <img src='http://www.web-design-talk.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  You too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-3171</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Tue, 14 Sep 2010 17:41:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-3171</guid>
		<description>&lt;a href=&quot;#comment-3169&quot; rel=&quot;nofollow&quot;&gt;@Stephen &lt;/a&gt; 

Hi Stephen,

Thanks for the comment. The -Requested-With was soemthing I accidentally came across by chance, but is REALLY useful. Nice blog you have there. BTW</description>
		<content:encoded><![CDATA[<p><a href="#comment-3169" rel="nofollow">@Stephen </a> </p>
<p>Hi Stephen,</p>
<p>Thanks for the comment. The -Requested-With was soemthing I accidentally came across by chance, but is REALLY useful. Nice blog you have there. BTW</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-3169</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Tue, 14 Sep 2010 14:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-3169</guid>
		<description>I was injecting a hidden POST value to identify AJAX requests, but this is much better. I noticed the X-Requested-With header while using Firebug today.

Dear readers: I highly recommend using that second snippet to simplify your &quot;dual-mode&quot; scripts. Place the &lt;code&gt;define&lt;/code&gt; line in your &quot;bootstrap&quot; file or in some other include that runs during every request. Then use the &quot;if&quot; block to switch between &quot;rendering&quot; modes. (JSON vs HTML)

If your readers need help finding a real-world use for this, send them to http://sholsinger.com/archive/2009/08/gracefully-degrading-ajax-php-jquery/ where I have written about using this type of method for a simple--gracefully degrading--newsletter sign-up form.</description>
		<content:encoded><![CDATA[<p>I was injecting a hidden POST value to identify AJAX requests, but this is much better. I noticed the X-Requested-With header while using Firebug today.</p>
<p>Dear readers: I highly recommend using that second snippet to simplify your &#8220;dual-mode&#8221; scripts. Place the <code>define</code> line in your &#8220;bootstrap&#8221; file or in some other include that runs during every request. Then use the &#8220;if&#8221; block to switch between &#8220;rendering&#8221; modes. (JSON vs HTML)</p>
<p>If your readers need help finding a real-world use for this, send them to <a href="http://sholsinger.com/archive/2009/08/gracefully-degrading-ajax-php-jquery/" rel="nofollow">http://sholsinger.com/archive/2009/08/gracefully-degrading-ajax-php-jquery/</a> where I have written about using this type of method for a simple&#8211;gracefully degrading&#8211;newsletter sign-up form.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-1413</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Fri, 26 Mar 2010 17:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-1413</guid>
		<description>Cheers :) 

Edited that code now.</description>
		<content:encoded><![CDATA[<p>Cheers <img src='http://www.web-design-talk.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Edited that code now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Gilford</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-1412</link>
		<dc:creator>Jay Gilford</dc:creator>
		<pubDate>Fri, 26 Mar 2010 16:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-1412</guid>
		<description>Nice website and a cool trick :)
One thing I did notice is you have an apostrophe in this line
if(&#039;IS_AJAX_REQUEST) {
which shouldn&#039;t be there

Regards

Jay</description>
		<content:encoded><![CDATA[<p>Nice website and a cool trick <img src='http://www.web-design-talk.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
One thing I did notice is you have an apostrophe in this line<br />
if(&#8216;IS_AJAX_REQUEST) {<br />
which shouldn&#8217;t be there</p>
<p>Regards</p>
<p>Jay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.web-design-talk.co.uk/197/detect-ajax-requests-using-the-x-requested-with-header-and-xmlhttprequest/comment-page-1/#comment-1411</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Fri, 26 Mar 2010 16:10:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=197#comment-1411</guid>
		<description>The article above edescribes how to detect requests coming from an AJAX action directly. I could submit a form using POST or via AJAX. The header I suggest allows you to isolate each type of request seperately.</description>
		<content:encoded><![CDATA[<p>The article above edescribes how to detect requests coming from an AJAX action directly. I could submit a form using POST or via AJAX. The header I suggest allows you to isolate each type of request seperately.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

