A
A
Alexander Interesting2021-06-27 17:44:53
AJAX
Alexander Interesting, 2021-06-27 17:44:53

Why is there "POST https://example.com/print.php 500" in the console?

The fact is that I use ajax to send a request to the page, it writes to the console POST https://example.com/print.php 500, even when I manually switch - everything works perfectly. In other places there are no such errors.

Usage:

Swal.fire({
    position: 'top',
    title: 'Вы уверены?',
    text: "Провести тест?",
    type: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#35D59D',
    cancelButtonColor: '#2e3356',
    cancelButtonText: 'Отмена',
    confirmButtonText: 'Да'
}).then((result) => {
    if (result.value) {
    connect();
        $.ajax({
            url: "print.php",
            type: "POST",
      	data: {one:'1',
      	    two:'2',
      	    three:'3'
      	},
            success: function(html){
      		$("#ajax").html(html);

            }
        });
    } else {
        Swal.fire({
          position: 'top',
            title: 'Действие отменено',
            showConfirmButton: false,
            timer: 1500,
            confirmButtonColor: '#35D59D',
            cancelButtonColor: '#2e3356'
        })
    }
})


print.php file:
echo $_POST['one'].$_POST['two'].$_POST['three'];

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question