I am trying to render a partial from a javascript in my assets directory. I found that I can't call the render method within the assets directory. But I cant move my ajax command out of the assets directory either. So my Question is now, how to pass my ajax result onto the action.js file in my view.
So I call the ajax on a onclick jQuery event:
/app/javascript/mymodel.js.coffee
$(document).ready ->
---some actions ----
$('.myid').click ->
---some action---
$.ajax 'mypath'
dataType: 'json'
success: (result)->
---render result in partial on myid-div---
So how do I pass my beloved result and myid onto:
/app/views/mymodel/show.js.erb
$('.myid').html("<%= escape_javascript( render( :partial => 'myartial') ) %>");
To render it out?
I'm banging my head around this for quite some time, so I would really appreciate some help!