Good morning, I have a problem when passing the parameters of a file type form and a checkbox group through ajax.
My code is as follows
$("#form_img").submit(function(event){
$('#p2').show();
//disable the default form submission
event.preventDefault();
//grab all form data
var formData = new FormData($(this)[0]);
var buckets = new Array();
$( "input[name='checkpoint[]']:checked" ).each( function() {
buckets.push( $( this ).val() );
} );
$.ajax({
url: 'img_point/',
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (returndata) {
//alert(returndata);
$('.resulttemp').html(returndata);
alertify.warning('Por favor espere…');
$('#p2').hide();
}
});
return false;
});
As I do to pass the variable buckets using the ajax code, I tried with the data method: {buckets: buckets, formData: formData}, but it does not work, I appreciate all the help possible. Thank you very much.