I have a code that does a validation in javascript, and would like it if validated as true, change a table from the database. I thought of using ajax, so as to validate as true, call a method in a .php file, however I do not know how to do it.
It would be necessary to send a session to ajax $_SESSION['membro'];
and ajax with that session, change in the database where the member name is the same as the session.
Was it something like this?
$.ajax({
url: 'script.php', //caminho do arquivo a ser executado
dataType: 'html', //tipo do retorno
type: 'post', //metodo de envio
data: session:$_SESSION['membro'], //valores enviados ao script
});