How in 2019 it is better to implement the work of the site, on ajax or ... standard browser methods? By the phrase standard browser methods, I mean this:

<form action="handler.php" method="POST"> <input type="text" name="input1" class="testinput"> <input type="submit" value="OK"> </form> 

And by the phrase ajax, I mean something like this:

 $.post("handler.php", { input1: $(".testinput").val() }, onAjaxSuccess); function onAjaxSuccess(data){ $("body").html(data); } 

What are the pros and cons of both methods and which method would you use?

    1 answer 1

    In 2019, there are several methods to "launch" the client site.

    • HTML-based, you do not bother to work with JS, as a result, the browser behaves as standard.
    • Custom JS, often you write JS manually, using small wrappers such as JQuery, and html is often generated on the server.
    • JS frameworks such as Angular, React, Vue, you use their functionality (templates, routing, testing, animations, preprocessors, typescript).

    Another question, "How is it better in 2019 to make the site work for users ?"

    Working on the site, users expect responsiveness, as little as possible interrupts and the right interface elements in the right place. In this case, it would be more rational to use JS frameworks to speed development and make quick changes.