I'm trying to get values from inputs without any action from user and then save it via php to txt file.

This is what I got so far:

```
var x = setInterval(function() { 
var email = $("#test").val();    
if(email != '' && email != newemail) {

     $('#display').append(email)

   $.ajax({
      type: "POST",
      url: 'inputs-saving.php',
      data: ({usremail:email}),
      success: function(data) {     
      }
    }); 

}
var newemail = $("#test").val();
}, 1000);

```

it works almost fine, but I need to check if value changed, because if I input some text it will be constantly writen in file every second.

I have also tried to add something like "var newemail = email", but can't make it work corectly.