title: How to troubleshoot silently failing js in Rails?
body: <p>It should be noted that I am not very proficient at using Firebug, but I haven't found any errors that explain the following issue.</p>
  
  <p>I have a <code>feed.js.erb</code> file containing the following code:</p>
  
  <pre><code>var $foos = $('&lt;%= escape_javascript(render(@foos)) %&gt;');
  $('#container').append($foos);
  $('#pagination_button a').attr('href', '&lt;%= feed_path + '?page=' + @page %&gt;');
  </code></pre>
  
  <p>When this ajax call is made <strong><em>the second time</em></strong>, it appears to fail silently. I see the appropriate response in the Firebug console, but <strong><code>$foos</code> is not altered</strong> and subsequently the <code>#container</code> is never appended.</p>
  
  <p>My html page only includes a loading indicator, which it successfully replaces on the first call. The second call is triggered from other javascript (<a href="http://www.infinite-scroll.com/" rel="nofollow">Infinite Scroll</a>).</p>
  
  <p>If it matters, I have noticed that the first call is made with an automatically generated timestamp parameter. After that I am replacing the target url as you can see on my <code>#pagination_button a</code>.</p>
  
  <p>How can I debug this in the browser?</p>
  
  <p><em><strong>Update</em></strong>: I used ERB to make <code>$foos</code> a dynamic variable ($foos1...$foos2) and noticed that this is also not working. So even though the new <code>@foos</code> are visible in the console's response, the first line of my javascript is not being evaluated. </p>