var formData = new FormData();
var xhr = new XMLHttpRequest();
xhr.open('POST', 'ServletMessage', true);
xhr.send(formData);
and I write this value in the database, the problem is that the page refreshes before writing to bd, and the value does not change on the screen. How can I wait for the servlet to write to the database, and then the page refresh?