<div class="text-center">
<form method="POST">
<select name="class" class="choose-class" onchange="send()">
<option selected disabled>Выберите класс</option>
<option value="5">5 класс</option>
<option value="6">6 класс</option>
<option value="7">7 класс</option>
<option value="8">8 класс</option>
<option value="9">9 класс</option>
</select>
<br>
</form>
<script type="text/javascript">
function send() {
var chooseСlass = $('.choose-class').val();
var url = '<?php echo $_SERVER['
DOCUMENT_ROOT ']."/index.php";?>';
var formData = new FormData();
formData.append('class', chooseСlass);
$.ajax({
url: url,
type: 'POST',
cache: !1,
contentType: !1,
processData: !1,
data: formData
})
}
</script>
<?php
if (!empty($_POST)){
echo $_POST['class'];
}
?>
</div>
from flask import Flask, request, json
import vk_api
import random
vk = vk_api.VkApi(token="token")
app = Flask(__name__)
@app.route('/', methods = ["POST"])
def main():
data = json.loads(request.data)
if data["type"] == "confirmation":
return ""
Вот код: