<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>armisael.silix.org &#187; remote function</title>
	<atom:link href="http://armisael.silix.org/tag/remote-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://armisael.silix.org</link>
	<description>Armisael's scientific world</description>
	<lastBuildDate>Thu, 01 Apr 2010 10:49:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby on Rails: remote functions do not work</title>
		<link>http://armisael.silix.org/2009/06/ruby-on-rails-remote-functions-do-not-work/</link>
		<comments>http://armisael.silix.org/2009/06/ruby-on-rails-remote-functions-do-not-work/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 09:56:37 +0000</pubDate>
		<dc:creator>Armisael</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[remote form tag]]></category>
		<category><![CDATA[remote function]]></category>

		<guid isPermaLink="false">http://armisael.silix.org/?p=57</guid>
		<description><![CDATA[Your remote_function or remote_form_tag could stop working if you use jQuery into your Ruby on Rails project. This is because the jQuery $ function is different from the prototype one, and RoR uses some particular function that is not available with jQuery.
For example, you can get an error like this submitting your remote_form_tag:

$(form).getElementsByTagName is not [...]]]></description>
			<content:encoded><![CDATA[<p>Your <em>remote_function</em> or <em>remote_form_tag</em> could stop working if you use jQuery into your Ruby on Rails project. This is because the jQuery $ function is different from the prototype one, and RoR uses some particular function that is not available with jQuery.</p>
<p>For example, you can get an error like this submitting your <em>remote_form_tag</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="error" style="font-family:monospace;">$(form).getElementsByTagName is not a function
http://localhost:3000/javascripts/prototype.js?1239274532
Line 3483</pre></div></div>

<p>To solve this kind of problem, you have to use the jQuery no-conflict method, like explaned on the <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries" target="_blank">jQuery site</a>. Simply add theese lines of code in your default layout between into a &lt;script&gt; tag:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Now, RoR can use prototype calling the default function $ and you can use jQuery using the jQuery function:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myId&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;def&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://armisael.silix.org/2009/06/ruby-on-rails-remote-functions-do-not-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
