问问题
1891 次
1 回答
0
好的,我知道了。我需要做两个改变:
- 首先,正如这个答案所建议的,我需要
text/json
在响应中返回一个 MIME 类型。我之前的操作是这样的:
def edit
respond_to do |format|
format.js
format.html
end
end
为了得到text/json
回应,我结束了这个:
def edit
respond_to do |format|
format.js { render :json => { :html => render_to_string('edit')}, :content_type => 'text/json' }
format.html
end
end
该更改触发ajax:success
并因此运行了开放模式功能。
- 但是,由于响应负载现在在
data.html
而不是只是data
,我需要调整modal.js.coffee
以实际将标记放入模态:
.html(data.html) // instead of .html(data)
于 2012-11-13T16:07:57.500 回答