A
Size: a a a
A
A
A
A
Б
ᅠᅠ
<script>
window.onunload = function() {
let a = 'exit'
$.ajax({
url : "send-info", // the endpoint
type : "POST", // http method
data : { the_post : a }, // data sent with the post request
// handle a successful response
success : function() {
alert('zbs')
},
// handle a non-successful response
error : function() {
alert('hyinya')
}
});
};
</script>
def get_post(request):
if request.method == 'POST':
post_text = request.POST.get('the_post')
print(post_text)
return HttpResponse(post_text)
path('send-info/',get_post),
A
if request.is_ajax()
вместо request.methodᅠᅠ
if request.is_ajax()
вместо request.methodA
ᅠᅠ
A
ᅠᅠ
A
ᅠᅠ
ᅠᅠ
꧁
A
$.ajax({
url: url,
method: 'post',
dataType: 'json',
data: {},
꧁
ᅠᅠ
$.ajax({
url: url,
method: 'post',
dataType: 'json',
data: {},
A