-1
built a form that validates within the wordpress function but every time I do Submit it cleans up the whole form and I don’t want it to do that I am sent data by jquery this way
form.submit(function (e) {
var dados = {
'action': 'acao_validador',
'dados': $(form).serialize()
};
ajaxscript = { ajax_url: '/wp-admin/admin-ajax.php' };
$.ajax({
url: ajaxscript.ajax_url,
data: dados,
datatype: 'json',
method: 'POST',
success: function (response) {
if (response.class == 'success') {
console.log(response);
} else {
console.log(response);
}
},
error: function (error) {
console.log(error);
}
});
e.preventDefault();
return false;
});