<?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: Return Multiple Values From Ajax Using MooTools and&#160;PHP</title> <atom:link href="http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools</link> <description>PHP, CSS, MooTools, jQuery, and Everything Else</description> <lastBuildDate>Thu, 11 Mar 2010 12:44:18 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>By: Enrique Barchiesi</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-13791</link> <dc:creator>Enrique Barchiesi</dc:creator> <pubDate>Thu, 19 Nov 2009 19:26:03 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-13791</guid> <description>Hi all, the solution is to use json_encode function in php, if you have a old version installed you may use the class json from http://www.boutell.com/scripts/jsonwrapper.html, it is a direct way to work. Some times i am having problem with the coding so may be you need to use utf8_encode() function for non standar characters.
I hope this help...
Regards , Enrique</description> <content:encoded><![CDATA[<p>Hi all, the solution is to use json_encode function in php, if you have a old version installed you may use the class json from <a
href="http://www.boutell.com/scripts/jsonwrapper.html" rel="nofollow">http://www.boutell.com/scripts/jsonwrapper.html</a>, it is a direct way to work. Some times i am having problem with the coding so may be you need to use utf8_encode() function for non standar characters.<br
/> I hope this help&#8230;<br
/> Regards , Enrique</p> ]]></content:encoded> </item> <item><title>By: Ahmed</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2812</link> <dc:creator>Ahmed</dc:creator> <pubDate>Sat, 23 Aug 2008 18:47:41 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2812</guid> <description>Is this the same thing if I use JSON? Because if yes, it makes it way easier.</description> <content:encoded><![CDATA[<p>Is this the same thing if I use JSON? Because if yes, it makes it way easier.</p> ]]></content:encoded> </item> <item><title>By: david</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2800</link> <dc:creator>david</dc:creator> <pubDate>Thu, 21 Aug 2008 15:58:09 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2800</guid> <description>&lt;p&gt;@Thomas:  Awesome!  Thank you for sharing that.&lt;/p&gt;</description> <content:encoded><![CDATA[<p>@Thomas:  Awesome!  Thank you for sharing that.</p> ]]></content:encoded> </item> <item><title>By: thomasd</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2796</link> <dc:creator>thomasd</dc:creator> <pubDate>Thu, 21 Aug 2008 13:52:47 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2796</guid> <description>david says:&lt;blockquote&gt;
@Alan: Good idea for servers that
serve the specified PHP5, but in my
shop, you can&#039;t assume the hosting
server will have PHP5.
&lt;/blockquote&gt;I had the same problem and solved it with this sweet little class:&lt;a href=&quot;http://mike.teczno.com/JSON.tar.gz&quot; rel=&quot;nofollow&quot;&gt;http://mike.teczno.com/JSON.tar.gz&lt;/a&gt;The usage is as easy as:require&#95;once(&#039;JSON.php&#039;);
$json = new Services&#95;JSON();//encoding an array or object
echo $json-&gt;decode(array(&#039;code&#039; =&gt; &#039;0&#039;, &#039;message&#039; =&gt;&#039;Your email address is not valid. Please try again.&#039;));//same for decoding a string
$obj = $json-&gt;decode($json&#95;string);and if you not sure or don&#039;t mind if your environment is php4 or php5 you can do something like this:if(!function&#95;exists(&#039;json&#95;encode&#039;)){
function json&#95;encode($obj){
require&#95;once(&#039;JSON.php&#039;);
$json = new Services&#95;JSON();
return $json-&gt;encode($obj);
}
}if(!function&#95;exists(&#039;json&#95;decode&#039;)){
function json&#95;decode($str){
require&#95;once(&#039;JSON.php&#039;);
$json = new Services&#95;JSON();
return $json-&gt;decode($str);
}
}and you never need to worry about it again!</description> <content:encoded><![CDATA[<p>david says:</p><blockquote><p> @Alan: Good idea for servers that<br
/> serve the specified PHP5, but in my<br
/> shop, you can&#8217;t assume the hosting<br
/> server will have PHP5.</p></blockquote><p>I had the same problem and solved it with this sweet little class:</p><p><a
href="http://mike.teczno.com/JSON.tar.gz" rel="nofollow">http://mike.teczno.com/JSON.tar.gz</a></p><p>The usage is as easy as:</p><p>require&#95;once(&#8216;JSON.php&#8217;);<br
/> $json = new Services&#95;JSON();</p><p>//encoding an array or object<br
/> echo $json-&gt;decode(array(&#8216;code&#8217; =&gt; &#8216;0&#8242;, &#8216;message&#8217; =&gt;&#8217;Your email address is not valid. Please try again.&#8217;));</p><p>//same for decoding a string<br
/> $obj = $json-&gt;decode($json&#95;string);</p><p>and if you not sure or don&#8217;t mind if your environment is php4 or php5 you can do something like this:</p><p>if(!function&#95;exists(&#8216;json&#95;encode&#8217;)){<br
/> function json&#95;encode($obj){<br
/> require&#95;once(&#8216;JSON.php&#8217;);<br
/> $json = new Services&#95;JSON();<br
/> return $json-&gt;encode($obj);<br
/> }<br
/> }</p><p>if(!function&#95;exists(&#8216;json&#95;decode&#8217;)){<br
/> function json&#95;decode($str){<br
/> require&#95;once(&#8216;JSON.php&#8217;);<br
/> $json = new Services&#95;JSON();<br
/> return $json-&gt;decode($str);<br
/> }<br
/> }</p><p>and you never need to worry about it again!</p> ]]></content:encoded> </item> <item><title>By: david</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2795</link> <dc:creator>david</dc:creator> <pubDate>Thu, 21 Aug 2008 13:32:53 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2795</guid> <description>&lt;p&gt;@xrado:  Interesting idea, but I feel my solution is a bit easier.&lt;/p&gt;</description> <content:encoded><![CDATA[<p>@xrado:  Interesting idea, but I feel my solution is a bit easier.</p> ]]></content:encoded> </item> <item><title>By: xrado</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2794</link> <dc:creator>xrado</dc:creator> <pubDate>Thu, 21 Aug 2008 13:01:39 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2794</guid> <description>what about returning xml data, you can wrap any kind of data in to &lt;![CDATA[$data]]&gt;</description> <content:encoded><![CDATA[<p>what about returning xml data, you can wrap any kind of data in to &lt;![CDATA[$data]]&gt;</p> ]]></content:encoded> </item> <item><title>By: Return Multiple Values From Ajax Using MooTools and PHP &#171; Rich Internet Applications</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2793</link> <dc:creator>Return Multiple Values From Ajax Using MooTools and PHP &#171; Rich Internet Applications</dc:creator> <pubDate>Thu, 21 Aug 2008 12:56:15 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2793</guid> <description>[...] Source [...]</description> <content:encoded><![CDATA[<p>[...] Source [...]</p> ]]></content:encoded> </item> <item><title>By: Oskar Krawczyk</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2788</link> <dc:creator>Oskar Krawczyk</dc:creator> <pubDate>Wed, 20 Aug 2008 22:41:31 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2788</guid> <description>Indeed I use JSON most of the time – simply encode it into a string (if I really need to), and decode on the other side. But for optimization sake – if we want to return a small amount of data – we might as well stick with a simple split().</description> <content:encoded><![CDATA[<p>Indeed I use JSON most of the time – simply encode it into a string (if I really need to), and decode on the other side. But for optimization sake – if we want to return a small amount of data – we might as well stick with a simple split().</p> ]]></content:encoded> </item> <item><title>By: david</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2787</link> <dc:creator>david</dc:creator> <pubDate>Wed, 20 Aug 2008 21:56:38 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2787</guid> <description>&lt;p&gt;I should say &quot;we can&#039;t assume&quot; -- you may assume away!&lt;/p&gt;</description> <content:encoded><![CDATA[<p>I should say &#8220;we can&#8217;t assume&#8221; &#8212; you may assume away!</p> ]]></content:encoded> </item> <item><title>By: Justin</title><link>http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools/comment-page-1#comment-2786</link> <dc:creator>Justin</dc:creator> <pubDate>Wed, 20 Aug 2008 21:52:52 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=353#comment-2786</guid> <description>David,I used to do something very similar.  For example, I&#039;d send back a response that was pipe delimited to separate different sets of data.  Then, each set of data was tilde delimited to separate functions to execute, variables, etc.Then, I discovered JSON.  It&#039;s SO much easier.  Now, I&#039;m doing something very different.  In my PHP, I write the JavaScript code that I want execute, return it to the calling page, and it gets executed.I&#039;m not sure this is smart or not, but it works VERY well.  Since I&#039;m primarily a PHP programmer, I prefer dealing with all the logic in PHP instead of trying to parse it out in JS.</description> <content:encoded><![CDATA[<p>David,</p><p>I used to do something very similar.  For example, I&#8217;d send back a response that was pipe delimited to separate different sets of data.  Then, each set of data was tilde delimited to separate functions to execute, variables, etc.</p><p>Then, I discovered JSON.  It&#8217;s SO much easier.  Now, I&#8217;m doing something very different.  In my PHP, I write the JavaScript code that I want execute, return it to the calling page, and it gets executed.</p><p>I&#8217;m not sure this is smart or not, but it works VERY well.  Since I&#8217;m primarily a PHP programmer, I prefer dealing with all the logic in PHP instead of trying to parse it out in JS.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 8/20 queries in 0.024 seconds using disk

Served from: davidwalsh.name @ 2010-03-11 12:53:25 -->