Im curious about what the best way to load a rails partial with jquery. So far I have tried a solution not working:
$(\'#imagecontent\').load(\'/newsletters/
With rails 3 you could do...
controller
@content = '/some/partial'
view - either haml.erb(html.erb) or js.erb
$('#myDiv').html("<%= escape_javascript render @content %>");
You could try this if rails 2 (only prototype available unless noConflict added)...
In the controller
@content = render :partial=>"/users/cool_partial"
Call your js
myFunction(#{@content.to_json})
Your function...
myFunction = function(content){
$("myDiv").html(content);
}
I do agree with neutrino that this could be better handled via an action.
def get_partial
render 'some/partial'
end
Hope this helps