问卷答题报网络异常

This commit is contained in:
cxt 2016-10-15 19:34:58 +08:00
parent a5375fc668
commit 750a9c9d38
1 changed files with 41 additions and 36 deletions

View File

@ -206,6 +206,8 @@
function onblur_<%= pq.id %>(obj)
{
$(window).unbind('beforeunload');
var val = $(obj).val().trim();
if(val != "") {
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
@ -223,7 +225,7 @@
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
}
</script>
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
@ -253,11 +255,13 @@
function onblur_<%= pa.id %>(obj)
{
$(window).unbind('beforeunload');
var val = $(obj).val().trim();
if(val != "") {
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_question_id: <%= pq.id %> ,
poll_question_id: <%= pq.id %>,
poll_answer_id: <%= pa.id %>,
vote_text: obj.value
},
@ -272,6 +276,7 @@
}
});
}
}
</script>
<p class="mb10"><%= i + 1 %>.<%= pa.answer_text%></p>
<input class="questionnaire-input" placeholder="在此填入答案" style="width: 93%" type="text" value="<%= get_anwser_vote_text(pq.id,User.current.id,pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>