I have a desktop version as well as a mobile version (currently not fully-functional) of a project that I'm working on.
For Desktop, I can render partials and replace DOM objects quite easily:
'controller.rb'
def func
@blah = "hey"
@button_label = "button"
respond_to do |format|
format.html
format.js
end
end
'_func.html.erb'
<%= blah %>
<%= button_to @button_label, {:controller => "controller", :action => "func"}, :method => "put", :remote => true, "data-role" => 'button' %>
'func.js.erb'
$('#camera_container').html("<%=j render 'func' %>")
The above code doesn't function as it does on Desktop. I have a completely separate mobile section, so any code changes will not affect the desktop, but the controllers are shared.
Of course, there's a button initially loaded whose action points to the func function in controller.rb, but then fails to "replace itself."
The above snippets work for the desktop version using standard jQuery. With jQuery-mobile, I receive a page loading error. Now, I feel that this has something to do with the buttons not being enhanced and the fact that I'm wanting to replace one button with a different button (at the very, very least).