JSFiddle - React, Tailwind, and code Playground

форма логина с паролем на аяксе

by hronic

HTML

<form method="POST" id="form">


<div>Введите номер лицевого счёта:</div>
<div><input type="text" value="" id="lc" name="2500012[lc]" data-id="id_test" required="required" placeholder="Лицевой счет"></div>
  <div>Введите логин:</div>
<input type="text" value="" id="nick" name="2500012[login]" required="required" placeholder="Логин"><br>
<input type="hidden" name="_token" value="sdfjIjkIl98df88dclkoLJHU77j" ><br>
<input type="hidden" name="2500012[id]" value="250025">
<input type="submit" name="send" value="Отправить">

</form>

CSS

input, select{
    border: 1px solid #5089ae;
    border-radius: 5px;
    padding: 5px;
    -webkit-box-shadow: inset 0px 0px 3px 0px rgba(50, 50, 50, 0.47);
    -moz-box-shadow:    inset 0px 0px 3px 0px rgba(50, 50, 50, 0.47);
    box-shadow:         inset 0px 0px 3px 0px rgba(50, 50, 50, 0.47);
    font-family: 'Exo 2', sans-serif;
    color: #585858 ;
    font-weight: 400;
}
input, select, .inFontL{
    font-size: 130%;
}

JavaScript

$('#form').on('submit',function(){
var res;
$('#form input').map(function(i,o){
var x = $(o).attr('name') + "=" + $(o).val();
if( $(o).attr('type') == 'text' )
{
 res += x;
} 

});
console.log(res);

  $.ajax({
   type: "post",
   data: {
   'token': 'token'
   },
   success: function(data){
//
   }
  });
  return false;
  
})