title: periodically_call_remote: Rails AJAX for a facebook app
body: <p>i'm building a RoR app for facebook using FBML and the Prototype JavaScript library.</p>
  
  <p>what i'm trying to do is have a div automatically refreshed, using the neat 
  <code>periodically_call_remote</code>, which creates a <a href="http://www.prototypejs.org/api/periodicalExecuter" rel="nofollow noreferrer" title="Prototype API">PeriodicalExecuter</a> object.</p>
  
  <p>here's the code:</p>
  
  <pre><code> &lt;%= render :partial =&gt; "status_item", :collection =&gt; @status %&gt;
   &lt;%= periodically_call_remote( :url =&gt; { :action =&gt; :status, :id =&gt; @hunt.id }, :update =&gt; 'status_div') %&gt;
  </code></pre>
  
  <p>i'm getting 2 kinds of errors:</p>
  
  <ol>
  <li><p><code>SyntaxError: Parse error</code>'s on fbml_static_get.php on <a href="http://biascica.pipps.net:8888/javascripts/prototype.js?1246455754" rel="nofollow noreferrer">http://biascica.pipps.net:8888/javascripts/prototype.js?1246455754</a> and the likes (effects.js and controls.js)</p></li>
  <li><p><code>ReferenceError</code>'s: <code>can't find variable a116508001384_PeriodicalExecuter</code></p></li>
  </ol>
  
  <p>this is the javascript code, as modified by facebook:</p>
  
  <pre><code>new a116508001384_PeriodicalExecuter(function() {new a116508001384_Ajax.Updater('status_div', '/corinna_test/servers/ren%C3%A9/treasure_hunts/12/status', {asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + a116508001384_encodeURIComponent('qBY5jTvJ04rEcvLsQzkhNkEhRXN1wRA2ITrgq/4JmVg=')})}, 10)
  </code></pre>
  
  <p>(notice how they appended <code>a116508001384_</code> in front of almost everything)</p>
  
  <p>i'm also getting <code>iframex</code> errors but i don't think that's a priority right now.</p>
  
  <p>can anyone help me make sense of this mess?</p>
  
  <p>thanks!
  asymmetric</p>