0
I’m trying to send this form through ajax and I’m not getting, is there something wrong? I’m beating my head against this for four hours without success.
Note: I am developing via wordpress and I am using a plugin called Newsletter to store the emails captained by the form. I already managed to make it work once, but in another office and on another site, but I ended up losing the code that works and I’m trying again to make it work.
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>