I have a html search box. If users hit their keyboard, I would like to pass this variable which is not submitted yet to python flask. I have no idea how to handle this. First code is html search box part and second code is python flask code.
<br> <input name="Country" type="text" id="Country" placeholder="Enter Country" oninput="myFunction()"/> oninput: <span id="result"></span>
<script>
function myFunction() {
// result.innerHTML = Country.value;
result.innerHTML = output;
};
</script>
@auth.route('/search', methods=['POST'])
def autoComplete():
country = request.form[Country.value]
output = autoCompletion.init(country)
return render_template("search.html", output=output)
Is there any way that passing a html search box string which is not submitted yet to python flask? Any help would be appreciate.