function onClickVote(){
    if($("input[name='answer']:checked").val()){
        $.ajax({
            type: "post",
            dataType: "json",
            data: "answer_id="+$("input[name='answer']:checked").val()+"&question_id="+$("#question_id").val(),
            url: $("#voteUrl").val(),
            beforeSend: function() {
                $("#poll_block").fadeOut(100);
            },
            success: function(oResponse, textStatus) {
                $("#poll_block").html(oResponse.message);
                $("#poll_block").fadeIn(500);
            },
            error: function(oResponse, textStatus) {
                $("#poll_block").html("error");
                $("#poll_block").fadeIn(500);
            }
        });
    }
}

function showResult(){
    $.ajax({
        type: "post",
        dataType: "json",
        data: "question_id="+$("#question_id").val(),
        url: $("#showResultUrl").val(),
        beforeSend: function() {
            $("#poll_block").fadeOut(100);
        },
        success: function(oResponse, textStatus) {
            $("#poll_block").html(oResponse.message);
            $("#poll_block").fadeIn(500);
        },
        error: function(oResponse, textStatus) {
            $("#poll_block").html("error");
            $("#poll_block").fadeIn(500);
        }
    });
}
