I'm trying to send this form via ajax and I'm not getting it, is something wrong? I'm banging my head on it, you love it for four hours without success.
Note: I'm developing via wordpress and I'm using a plugin called Newsletter to store the emails capped by the form. I already managed to make it work once, but in another estancia and in another site, but I ended up losing the code that works and I'm trying to make it work again.
var fmr = $('#formsnewslatetr');
var dados = $('#formsnewslatetr').serialize();
fmr.submit(function (e){
e.preventDefault();
$.ajax(
{
type: fmr.attr('method'),
url: fmr.attr('action'),
data: dados,
success: function ( response )
{
$('.success-box').fadeIn();
var retorno = 'true';
fmr.fadeOut();
},
error: function ( txt )
{
alert( "ERRO" );
}
}
);
});
<form id="formsnewslatetr" method="post" action="/?na=s" onsubmit="return newsletter_check(this)" class="form-inline w-100">
<div class="form-group w-100">
<input class="i-email" type="email" name="ne" id="email" placeholder="Email" required="">
<input class="b-email" type="submit" value="Assinar">
</div>
</form>