D
D
DarkHoIe2019-11-01 22:59:35
AJAX
DarkHoIe, 2019-11-01 22:59:35

Why is the alert not displayed?

Good evening,
I'm learning ajax and why is this alert not displayed on successful submission?

function send () {
            $.ajax({
                type: "POST",
                url: "pasha.php",
                data: "test=1",
                success: function(data) {
                    if (data == 'success') {
                        alert("dsqweqwes");
                    }
                }
            })
        }

<?php if($_POST['test'] == 1){ echo 'sea';}?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pashenka, 2019-11-01
@DarkHoIe

Well, you send the string 'sea' in response, and expect to see a success in success. Is the sea a suxes?

N
Nadim Zakirov, 2019-11-02
@zkrvndm

function send () {
            $.ajax({
                type: "POST",
                url: "pasha.php",
                data: "test=1",
                success: function(data) {
                        alert(data);
                }
            })
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question