P
P
PavelVlas2020-05-25 12:21:46
PHP
PavelVlas, 2020-05-25 12:21:46

How to update a record in the database through a form without buttons?

5ecb8ded18e46048996935.png
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

3 answer(s)
A
Armenian Radio, 2020-05-25
@gbg

Wait 2 seconds after changing the character and save
Save on loss of focus.

D
Dmitry Komchev, 2020-05-25
@Lebezniy

document.querySelector('.class').addEventListener('input', () => {
        // сохраняете в базу 
});

Q
qwermus, 2020-05-25
@qwermus

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 question

Ask a Question

731 491 924 answers to any question