HTTP GET / 200 [0.06, 127.0.0.1:56694]
None - это ptrint (name = self.request.POST.get("games_sorted_name"))
HTTP POST / 200 [0.02, 127.0.0.1:56694]
jquery.js:2 POST http://127.0.0.1:8000/ 500 (Internal Server Error)
send @ jquery.js:2
ajax @ jquery.js:2
(anonymous) @ (index):187
dispatch @ jquery.js:2
y.handle @ jquery.js:2
<form method="post" action="{% url 'base' %}" id="sorted-games">
{% csrf_token %}
<div class="tab">
{% for i in game_sorted %}
<button id="games_sorted" name="games_sorted" type="submit" value="{{i.name}}" class="tablinks">{{ i.name }}</button>
{% endfor %}
</div>
</form>
<div id="result-games-sorted">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type = "text/javascript">
$('.form-select').on('change', function() {
var form-select = $('.form-select').val();
var url = '{% url 'base' %}'; // здесь указываем адрес PHP файла
var formData = new FormData();
formData.append('class', form-select);
$.ajax({ // отправляем запрос
url: url,
type: 'POST',
cache: false,
contentType: false,
processData: false,
data: formData
});
});
</script>
{% crispy game_sorted_form %}