function saveData() {
    $fo = $("#form");
    $fo.addClass("sent");
    $("#thanks").addClass("thanks_sent");
    $("body").addClass("body_sent");

    $.ajax({
        type: "GET",
        url: "submit.php",
        data: {
            comment:  $("#form")[0].children[1].value,
            name:  $("#form")[0].children[2].children[0].value,
            local:  $("#form")[0].children[2].children[1].value,
            age:  $("#form")[0].children[2].children[2].value,
            q: selected_question
        },
        success : function(data) { 

            console.log(data);
                }
            });
}


$(document).ready(function(){
    $.getJSON("../js/questions.json", function(data){
        selected_question = Math.floor(Math.random() * data.length);
        t = $("#question_title")[0];
        att_id = t.getAttribute("title_id");
        if (att_id != "") {
            att_id = Number(att_id);
            if (!isNaN(att_id)) {
                selected_question = att_id;
            }
        }
        console.log(data);
        console.log(data[selected_question]);
        $("#question_title")[0].innerHTML = data[selected_question];
    });

    setTimeout(function () {
        window.scrollTo(0, 0);
    }, 500);
});






