update div tag

update div tag

Hi,

I'm really hoping there's some Rails developers perusing this forum. I did ask this question on the Google Rails Talk group last week but I received no answer, and I've been stuck for more than a week...

I'm trying to update a div on a page with an Ajax call and it doesn't work. If I call jquery directly from the browser (no Ajax), the div does get updated. However, if I call it through a remote call, the div remains unchanged. A remote call in Rails makes an Ajax call back to the server, which pushes back the following content: $('.mydiv').html('world');. Nothing happens to mydiv. 

I'm a backend developer and I don't understand jquery that well, let alone jquery mobile. I tried adding .page() and .trigger('create') like I've found on some posts, but that didn't do anything. Also, I made sure that the cache tag was not used.

Thanks,
Jenna

PS. Here's my code:
<div data-role="content">
  <div class="content-primary">
    <div class="mydiv">something</div>
    <div><a href="#" onclick="$('.mydiv').html(' hello');">click</a></div> <!-- this works -->
    <div><%= link_to foobar_url, :remote => true, :method => :put, 'data-ajax' => 'false' do %>click<% end %></div> <!-- this doesn't-->
  </div>
</div>
def foobar
  respond_to do |format|
    format.mobile { render :layout => false }
  end
end
$('.mydiv').html('world'); // in foobar.mobile.erb