G
G
GineTik2020-05-25 18:05:36
PHP
GineTik, 2020-05-25 18:05:36

AJAX not working?

Hi all!
Ajax is not working for me

Here is the code:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

// в файле js
$.ajax({
             url: "http://sait/pages/profil.php",
             type: "POST",
             data: {ok: 'ok'},
             complete: function() {alert('+');},
             error: function() {alert('-');},
             BeforeSend: function() {alert('-');}
});

(and I also included the js file)

By the way, alert('+'); displays, but the data does not come

By the way, I also wanted to ask whether it is obligatory to write sait/pages/profil.php?login=Top because there is such a link on the site or can you just say sait/pages/profil.php ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-05-25
@DMGarikk

$.ajax code, etc. must be written inside script tags

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script>
     $.ajax({....блаблабла
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question