问卷答题报网络异常
This commit is contained in:
parent
a5375fc668
commit
750a9c9d38
|
@ -206,24 +206,26 @@
|
||||||
function onblur_<%= pq.id %>(obj)
|
function onblur_<%= pq.id %>(obj)
|
||||||
{
|
{
|
||||||
$(window).unbind('beforeunload');
|
$(window).unbind('beforeunload');
|
||||||
$.ajax({
|
var val = $(obj).val().trim();
|
||||||
type: "post",
|
if(val != "") {
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
$.ajax({
|
||||||
data: {
|
type: "post",
|
||||||
poll_question_id: <%= pq.id %> ,
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
vote_text: obj.value
|
data: {
|
||||||
},
|
poll_question_id: <%= pq.id %> ,
|
||||||
success: function (data) {
|
vote_text: obj.value
|
||||||
var dataObj = eval(data);
|
},
|
||||||
obj.value = dataObj.text;
|
success: function (data) {
|
||||||
var span = $('#percent');
|
var dataObj = eval(data);
|
||||||
span.html(dataObj.percent);
|
obj.value = dataObj.text;
|
||||||
},
|
var span = $('#percent');
|
||||||
error: function () {
|
span.html(dataObj.percent);
|
||||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
},
|
||||||
}
|
error: function () {
|
||||||
});
|
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</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" %>>
|
<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,24 +255,27 @@
|
||||||
function onblur_<%= pa.id %>(obj)
|
function onblur_<%= pa.id %>(obj)
|
||||||
{
|
{
|
||||||
$(window).unbind('beforeunload');
|
$(window).unbind('beforeunload');
|
||||||
$.ajax({
|
var val = $(obj).val().trim();
|
||||||
type: "post",
|
if(val != "") {
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
$.ajax({
|
||||||
data: {
|
type: "post",
|
||||||
poll_question_id: <%= pq.id %> ,
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
poll_answer_id: <%= pa.id %>,
|
data: {
|
||||||
vote_text: obj.value
|
poll_question_id: <%= pq.id %>,
|
||||||
},
|
poll_answer_id: <%= pa.id %>,
|
||||||
success: function (data) {
|
vote_text: obj.value
|
||||||
var dataObj = eval(data);
|
},
|
||||||
obj.value = dataObj.text;
|
success: function (data) {
|
||||||
var span = $('#percent');
|
var dataObj = eval(data);
|
||||||
span.html(dataObj.percent);
|
obj.value = dataObj.text;
|
||||||
},
|
var span = $('#percent');
|
||||||
error: function () {
|
span.html(dataObj.percent);
|
||||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
},
|
||||||
}
|
error: function () {
|
||||||
});
|
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<p class="mb10"><%= i + 1 %>.<%= pa.answer_text%></p>
|
<p class="mb10"><%= i + 1 %>.<%= pa.answer_text%></p>
|
||||||
|
|
Loading…
Reference in New Issue