0
我确信这很简单,但我会很感激任何帮助。ajax调用后不加载对象
我有什么是显示问题和答案的页面。
我的模型建立,这样的问题(这实际上是一个名为调查)窝我想提交后以递增到下一个问题的答案
我所做的是创建了一个调用形式一个JavaScript(AJAX回调更新控制器),一切运作良好,但当我尝试渲染的部分它不显示,我从控制台没有错误我的update.js.erb是我想渲染
$('#questionarea ul').show().load("<%= escape_javascript render :partial => "current_question" %> ");
部分_current_question.html.erb很简单, <%= @current_question%>
我一直在使用Chrome浏览器客户端来调试,但我没有得到任何错误,并在控制台显示正常执行 任何及所有的帮助表示赞赏 我也加入,以供参考HTML还有JavaScript的被称为阿贾克斯以及 _form.html.erb
<%= form_for @category, remote: true do |f| %>
<ul id= 'questionarea'>
<%[email protected] %>
</ul>
<ul>
<%=hidden_field_tag(:survey_id, @category.surveys.first.survey_id) %>
<%=hidden_field_tag(:user_id, params[:id]) %>
</ul>
<ul id= 'answerarea'>
<%= radio_button_tag(:agree , 5) %>
<%= label_tag(:agree_5, "I completely agree ") %>
<%= radio_button_tag(:agree , 4) %>
<%= label_tag(:agree_4, "I agree ") %>
<%= radio_button_tag(:agree , 3) %>
<%= label_tag(:agree_3, "I kind of agree ") %>
<%= radio_button_tag(:agree , 2) %>
<%= label_tag(:agree_2, "I disagree ") %>
<%= radio_button_tag(:agree , 1) %>
<%= label_tag(:agree_1, "I completly disagree ") %>
This statement is:
<%= radio_button_tag(:importance , 3) %>
<%= label_tag(:importance_3, "Incredibly important ") %>
<%= radio_button_tag(:importance , 2) %>
<%= label_tag(:importance_2, "Kind of important") %>
<%= radio_button_tag(:importance , 3) %>
<%= label_tag(:importance_1, "A good thing to trade for something I care about ") %>
</ul>
<ul>
<li>Comments:</li>
<li><%= text_field_tag :comments %></li>
</ul>
<ul>
<%= f.submit %>
我的JavaScript(form.js)
$('.edit_category input[type=submit]').click(function() {
$(this).parent('form').submit();
});
在此先感谢
** $('#questionarea ul')**似乎没有指向任何东西,**#questionarea **中没有** ul **标签,我想你的意思是** $('#questionarea') ** – Raindal 2013-04-29 18:56:15
谢谢你是真的很欣赏我喜欢这个网站的快速反应! – Jan 2013-04-29 19:11:57
我发布了回复,因此很明显这是解决方案。顺便说一下,欢迎您:) – Raindal 2013-04-29 19:15:01