I use this code for get form data in json object. After submit I get this response:
{ user: "asdf", password: "asdfsadf" }
But the problem is i didn't know how to save this in database using php. If any one knows how to save in db please guide me. Any help is appreciated.
HTML code
<form onsubmit='return onSubmit(this)'>
  <input name='user' placeholder='user'><br>
  <input name='password' type='password' placeholder='password'><br>
  <button type='submit'>Try</button>
</form>
Javascript code
function onSubmit( form ){
    var data = $(form).serializeArray(); //  <-----------
    var json = {};
    $.each(data, function() {
        json[this.name] = this.value || '';
    });
    $.ajax({
        type: "POST",
        url: "php/tracker.php",
        data: json,
        dataType: "json"
    });
}
 
     
    