<?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: Never worry about ASP.NET AJAX&#8217;s .d again</title>
	<atom:link href="http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/feed/" rel="self" type="application/rss+xml" />
	<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/</link>
	<description>ASP.NET and AJAX code, ideas, and examples.</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:50:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: nerd</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43470</link>
		<dc:creator>nerd</dc:creator>
		<pubDate>Tue, 31 May 2011 16:39:50 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43470</guid>
		<description>you right, but i think that return just a value there is a bad practice or bad use of JSON cause if we are talking about JSON (JavaScript Object Notation) responses, return a lonely value is the mistake (even if in javascript everything is an object).

You right, but if programmers do not understand what JSON it is then we should correct to teach the right way.

Regards!</description>
		<content:encoded><![CDATA[<p>you right, but i think that return just a value there is a bad practice or bad use of JSON cause if we are talking about JSON (JavaScript Object Notation) responses, return a lonely value is the mistake (even if in javascript everything is an object).</p>
<p>You right, but if programmers do not understand what JSON it is then we should correct to teach the right way.</p>
<p>Regards!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43469</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Tue, 31 May 2011 16:23:52 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43469</guid>
		<description>People often return scalar values from their methods (which is valid JSON with the .d wrapper).  A boolean indicating success/failure of an update is common, for example.  If that method returns &lt;code&gt;false&lt;/code&gt;, the ternary approach would pass &lt;br&gt;&lt;code&gt;{ d: false }&lt;/code&gt; back through the dataFilter instead of &lt;code&gt;false&lt;/code&gt;.  Same issue with any methods that might return 0 or an empty string.

If you&#039;re never returning anything but an object, the ternary should be safe, yes.</description>
		<content:encoded><![CDATA[<p>People often return scalar values from their methods (which is valid JSON with the .d wrapper).  A boolean indicating success/failure of an update is common, for example.  If that method returns <code>false</code>, the ternary approach would pass <br /><code>{ d: false }</code> back through the dataFilter instead of <code>false</code>.  Same issue with any methods that might return 0 or an empty string.</p>
<p>If you&#8217;re never returning anything but an object, the ternary should be safe, yes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nerd</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43468</link>
		<dc:creator>nerd</dc:creator>
		<pubDate>Tue, 31 May 2011 16:17:25 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43468</guid>
		<description>but if you return valid json structures there is no way that the value could be  an unexpected  &#039;false&#039; or &#039;null&#039;, actually i use this code in almost 6 applications in different servers and different .Net frameworks and i don&#039;t get any error, when you return a json object you know the sctructure and possible values, so you shouldn&#039;t get any surprise.</description>
		<content:encoded><![CDATA[<p>but if you return valid json structures there is no way that the value could be  an unexpected  &#8216;false&#8217; or &#8216;null&#8217;, actually i use this code in almost 6 applications in different servers and different .Net frameworks and i don&#8217;t get any error, when you return a json object you know the sctructure and possible values, so you shouldn&#8217;t get any surprise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43467</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Tue, 31 May 2011 16:09:39 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43467</guid>
		<description>You would run into trouble there if the return value was intentionally the value &lt;code&gt;false&lt;/code&gt; or something ambiguously falsy like the number 0 or null.</description>
		<content:encoded><![CDATA[<p>You would run into trouble there if the return value was intentionally the value <code>false</code> or something ambiguously falsy like the number 0 or null.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nerd</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43466</link>
		<dc:creator>nerd</dc:creator>
		<pubDate>Tue, 31 May 2011 16:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43466</guid>
		<description>actually, can be converted to:

data = data.d ? data.d : data;</description>
		<content:encoded><![CDATA[<p>actually, can be converted to:</p>
<p>data = data.d ? data.d : data;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A quick guide to have jQuery call your ASP.NET PageMethods &#171; I Came, I Learned, I Blogged</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43403</link>
		<dc:creator>A quick guide to have jQuery call your ASP.NET PageMethods &#171; I Came, I Learned, I Blogged</dc:creator>
		<pubDate>Sat, 21 May 2011 15:15:58 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43403</guid>
		<description>[...] be the case, although a more complex solution for checking if a &#8216;d&#8217; is there already exists. Anyway, the proposed solution simply takes a JSON string returned from from the server, parses it [...]</description>
		<content:encoded><![CDATA[<p>[...] be the case, although a more complex solution for checking if a &#8216;d&#8217; is there already exists. Anyway, the proposed solution simply takes a JSON string returned from from the server, parses it [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ASP.NET, AJAX i JSON &#171; Asp.net &#171; Web Development &#171; Pure Development Blog</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43336</link>
		<dc:creator>ASP.NET, AJAX i JSON &#171; Asp.net &#171; Web Development &#171; Pure Development Blog</dc:creator>
		<pubDate>Sun, 08 May 2011 00:09:27 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43336</guid>
		<description>[...] Never worry about ASP.NET AJAX’s .d again [...]</description>
		<content:encoded><![CDATA[<p>[...] Never worry about ASP.NET AJAX’s .d again [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Herbots</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-43177</link>
		<dc:creator>Robin Herbots</dc:creator>
		<pubDate>Mon, 18 Apr 2011 11:27:29 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-43177</guid>
		<description>As from Jquery 1.5 I use the following to solve the .d 

  converters: {
        // Evaluate text as a json expression
        &quot;text json&quot;: function(data) {
            var dataObj = $.parseJSON(data);
            return dataObj.hasOwnProperty(&#039;d&#039;) ? dataObj.d : dataObj;
        }
    }</description>
		<content:encoded><![CDATA[<p>As from Jquery 1.5 I use the following to solve the .d </p>
<p>  converters: {<br />
        // Evaluate text as a json expression<br />
        &#8220;text json&#8221;: function(data) {<br />
            var dataObj = $.parseJSON(data);<br />
            return dataObj.hasOwnProperty(&#8216;d&#8217;) ? dataObj.d : dataObj;<br />
        }<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jordan</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-42836</link>
		<dc:creator>Jordan</dc:creator>
		<pubDate>Mon, 28 Mar 2011 23:08:05 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-42836</guid>
		<description>THANK YOU.

I was about to blow my brains out because of this stupid design choice.</description>
		<content:encoded><![CDATA[<p>THANK YOU.</p>
<p>I was about to blow my brains out because of this stupid design choice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikke!!!</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-41919</link>
		<dc:creator>Mikke!!!</dc:creator>
		<pubDate>Sat, 29 Jan 2011 20:16:09 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-41919</guid>
		<description>Daaaamn this was my fk problem all the day, saved to kill my self :( hahaha
just note:
 i dunno why the response, filtering the d isn&#039;t reco by JS, is you debug thru the response is a JSON....</description>
		<content:encoded><![CDATA[<p>Daaaamn this was my fk problem all the day, saved to kill my self :( hahaha<br />
just note:<br />
 i dunno why the response, filtering the d isn&#8217;t reco by JS, is you debug thru the response is a JSON&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-39352</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 12 Jul 2010 13:47:14 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-39352</guid>
		<description>The first thing I would do in that situation is to watch the response in Firebug to see what&#039;s coming back.  If it&#039;s not hitting your success handler at all, you might be throwing a 500 error on the server-side.

Also, double check that there are no JavaScript errors on the page.

Finally, if you&#039;re triggering the $.ajax() call with an element that also triggers page navigation or form submission, be sure that you&#039;re using &lt;em&gt;return false&lt;/em&gt; or &lt;em&gt;event.preventDefault&lt;/em&gt; to prevent that from occurring. Otherwise, the browser will usually navigate before the $.ajax() callback completes, making it seem like the $.ajax() call didn&#039;t work.  This can be especially confusing with form submissions, since they may very quickly refresh the page and it isn&#039;t obvious that anything happened.</description>
		<content:encoded><![CDATA[<p>The first thing I would do in that situation is to watch the response in Firebug to see what&#8217;s coming back.  If it&#8217;s not hitting your success handler at all, you might be throwing a 500 error on the server-side.</p>
<p>Also, double check that there are no JavaScript errors on the page.</p>
<p>Finally, if you&#8217;re triggering the $.ajax() call with an element that also triggers page navigation or form submission, be sure that you&#8217;re using <em>return false</em> or <em>event.preventDefault</em> to prevent that from occurring. Otherwise, the browser will usually navigate before the $.ajax() callback completes, making it seem like the $.ajax() call didn&#8217;t work.  This can be especially confusing with form submissions, since they may very quickly refresh the page and it isn&#8217;t obvious that anything happened.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug McDonald</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-39319</link>
		<dc:creator>Doug McDonald</dc:creator>
		<pubDate>Thu, 08 Jul 2010 13:29:02 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-39319</guid>
		<description>I seem to be hitting a very similar issue with returning msg.d.

It&#039;s presumably either returning but not getting into the &#039;success&#039; block or just not returning at all.

Any ideas on a way round this?</description>
		<content:encoded><![CDATA[<p>I seem to be hitting a very similar issue with returning msg.d.</p>
<p>It&#8217;s presumably either returning but not getting into the &#8216;success&#8217; block or just not returning at all.</p>
<p>Any ideas on a way round this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fergal Breen</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-39197</link>
		<dc:creator>Fergal Breen</dc:creator>
		<pubDate>Wed, 23 Jun 2010 15:16:50 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-39197</guid>
		<description>It simply did not return at all :S
FYI: Net 3.51</description>
		<content:encoded><![CDATA[<p>It simply did not return at all :S<br />
FYI: Net 3.51</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-39196</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Wed, 23 Jun 2010 15:13:23 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-39196</guid>
		<description>That should only work on the .NET 2.0 version that doesn&#039;t include the .d.  What trouble did you have with returning msg.d?</description>
		<content:encoded><![CDATA[<p>That should only work on the .NET 2.0 version that doesn&#8217;t include the .d.  What trouble did you have with returning msg.d?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fergal Breen</title>
		<link>http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/#comment-39182</link>
		<dc:creator>Fergal Breen</dc:creator>
		<pubDate>Tue, 22 Jun 2010 11:10:24 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=883#comment-39182</guid>
		<description>I had trouble with:

if (msg.hasOwnProperty(&quot;d&quot;))
                return msg.d
            else
                return msg;

I converted to:
if (msg.hasOwnProperty(&quot;d&quot;))
                return msg.valueOf;
            else
                return msg;

Any thoughts on this tactic?</description>
		<content:encoded><![CDATA[<p>I had trouble with:</p>
<p>if (msg.hasOwnProperty(&#8220;d&#8221;))<br />
                return msg.d<br />
            else<br />
                return msg;</p>
<p>I converted to:<br />
if (msg.hasOwnProperty(&#8220;d&#8221;))<br />
                return msg.valueOf;<br />
            else<br />
                return msg;</p>
<p>Any thoughts on this tactic?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

