Hello, I need to send the form without reloading the page, with further actions on the page, that is, after sending the form, I also need to click on the confirmation pop-up menu, how can this be implemented via JS?

    2 answers 2

    This can be done with AJAX .

    To work with AJAX, you can use any library (for example, jQuery) or write everything on pure JS. The first, IMHO, more preferably.

    • There is a website with a chat, and I’m writing a browser extension to send a message from me when I’ve entered it, but there’s no button to send anything, that is, you can send a message just by pressing enter, tried sending it reloads through the form-page, and after sending it there should be a window where you need to confirm the input. - SloGS
    • one
      @SloGS, as they say, what the question is and the answer. But, even with such a problem statement without AJAX, you most likely. not enough. - Streletz
    • But the site is not mine, but when sending a message via enter, does ajax be used there? Sorry for the wrong question. - SloGS
    • @SloGS is not in ajax (but yes, you need it). And the fact that you do not know how to work with him, read the documentation. On the Internet, a huge number of examples of this. Even here on the site, this question has been repeatedly raised. - Vasily Barbashev

    You need a handler

    $(document).ready(function () {}); поместить функцию вызова ajax: $.ajax({ type: "POST", url: "update.php", data: { Id: Data1, Name: Data2, Message: Data3 }, success: function (data) { $("#pro").html(data); } } ) }; 

    Well, accordingly, in ajax everything you need