I have a feeling this is pretty basic stuff, it sounds like it should be. But I can't find this anywhere online. The setting is simple:
I have a variable foo = 1, now all I want to do is send that over to my app.py. I understand that I would be needing AJAX, so I have that in there as well. Curently what I think I need to do is something like this:
js :
$(function() {
        $('#btn').click(function() {
            var answer = 1
        $.ajax({
            url: '/checkAnswer',
            data: answer,
            type: 'GET',
            success: function(data) {
                console.log(data);
            },
            error: function(error) {
                console.log(error);
            }
        });
        });
        });
py :
@app.route('/checkAnswer', methods=['GET', 'POST'])
def checkAnswer():
    try:
        answer = request.data
        if answer == 1:
            return 'ham'
        else:
            return answer
    except Exception as e:
        return 'foo bar'
 
    