Using Ajax and jQuery to log in a user through a PHP script, is this safe?

The quick question is, is it safe to use the jQuery.post function in jQuery to pass user login information into a PHP script? I am thinking about using a piece of code, for example:

 $("#login_form").submit(function() {
  var unameval = $("#username").val();
  var pwordval = $("#password").val();
  $.post("backend.php", { username: unameval, password: pwordval }, 
                function(data) {
   $("#status p").html(data);
  });
  return false;
 });

I'm just wondering how safe this is, like creating a standard login form that asks for a new page when submitted.

+3
source share
2 answers

jQuery . , . SSL, CSRF. CSRF, , , .

+4

. SSL, , , cookie . - - .

+4

Source: https://habr.com/ru/post/1734627/


All Articles