Does anyone uses Ajax with FormLister?
It seems to work but the attachment is not added.
Need to add FormData but I have no idea how.
<div id="ajaxForm">
{{contactFormAjax}}
</div>
My form tpl:
<input type="file" name="file" id="fileField" value="[+file.value+]" />
My script:
$(document).on('submit','#ajaxForm form',function(ev){
var frm = $('#ajaxForm form');
$('#submit').prop( "disabled", true );
$.ajax({
type: 'post',
url: '[(site_url)]ajaxform',
data: frm.serialize(),
success: function (data) {
$('#ajaxForm').empty();
$('#ajaxForm').html( data );
}
});
ev.preventDefault();
});
https://snipp.ru/jquery/uploads-files-ajax-jquery