Skip to content
Snippets Groups Projects
Commit dcbf60c1 authored by echicken's avatar echicken :chicken:
Browse files

submitPollAnswers - was missing 'sub' argument; does what it says on the tin;...

submitPollAnswers - was missing 'sub' argument; does what it says on the tin; handle response from server, disable & style inputs.
parent 3508a5b6
No related branches found
No related tags found
No related merge requests found
...@@ -381,13 +381,27 @@ function getVotesInThreads(sub) { ...@@ -381,13 +381,27 @@ function getVotesInThreads(sub) {
); );
} }
function submitPollAnswers(id) { function submitPollAnswers(sub, id) {
if ($('input[name="poll-' + id + '"]:checked').length < 1) return;
var answers = [];
$('input[name="poll-' + id + '"]:checked').each( $('input[name="poll-' + id + '"]:checked').each(
function () { function () { answers.push($(this).val()); }
alert($(this).val()); );
answers = answers.join('&answer=');
$.getJSON(
'./api/forum.ssjs?call=submit-poll-answers&sub=' + sub + '&id=' + id + '&answer=' + answers,
function (data) {
$('input[name="poll-' + id + '"]').each(
function () {
$(this).attr('disabled', true);
if ($(this).prop('checked')) {
$(this).parent().parent().addClass('upvote-bg');
}
}
);
$('submit-poll-' + id).attr('disabled', true);
} }
); );
// async ./api/forum.ssjs?call=submit-poll-answers&sub=x&id=x&answer=x&answer=x...
} }
function pollControl(id, count) { function pollControl(id, count) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment