1891 次
1 に答える
0
OK, got it. I needed to make two changes:
- First, as suggested by this answer, I needed to be returning a
text/json
MIME type on the response. My action previously looked like this:
def edit
respond_to do |format|
format.js
format.html
end
end
To get a text/json
response I wound up with this:
def edit
respond_to do |format|
format.js { render :json => { :html => render_to_string('edit')}, :content_type => 'text/json' }
format.html
end
end
That change triggered ajax:success
and therefore ran the open-modal functions.
- However, because the response payload was now in
data.html
rather than justdata
, I needed to tweak themodal.js.coffee
to actually put markup in the modal:
.html(data.html) // instead of .html(data)
于 2012-11-13T16:07:57.500 に答える