function onClickVote(){      
    $.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(){
	alert(1);
    $.ajax({
        type: "post",
        dataType: "json",
        data: "question_id="+$("#question_id").val(),
        url: $("#showResultUrl").val(),
        beforeSend: function() {
            $("#poll_block").fadeOut(100);
        },
        success: function(oResponse, textStatus) {alert(2);
            $("#poll_block").html(oResponse.message);
            $("#poll_block").fadeIn(500);
        },
        error: function(oResponse, textStatus) {alert(3);
            $("#poll_block").html("error");
            $("#poll_block").fadeIn(500);
        }
    });
}
