Answer the question
In order to leave comments, you need to log in
How to update a record in the database through a form without buttons?
I have just such a form in which the data from the database, after editing each character in it, I want it to be immediately saved to the database without any save buttons, etc.
Answer the question
In order to leave comments, you need to log in
Wait 2 seconds after changing the character and save
Save on loss of focus.
document.querySelector('.class').addEventListener('input', () => {
// сохраняете в базу
});
There is a script on which the form gets after pushing the button. You should remove the button and instead do this:
$(document).on('keyup','.input-class',function(){
// Send data
$.post(
'URL,
data,
function() {
})
.done(function(res) {
})
.fail(function() {
});
return false;
});
Accordingly, in the URL, substitute the URL of the script, in data, substitute the value from the input. Something like this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question