I need to submit my controller an image and some data, and I need that ajax wait for the processing of my data so that you can show in another page after the data save them in my database, but when I use async false it already falls ajax error in the property, any idea how to solve this?
my code :
var album;
$('#buttonNex').click(function () {
var url = 'NextPage';
var fd = new FormData();
fd.append('file', $('#imageSe')[0].files[0]);
fd.append('title', $('#inputitle').val());
fd.append('artist', $('#inputArtist').val());
fd.append('twitter', $('#inputTwitter').val());
$.ajax({
url: url,
type: 'POST',
data: fd,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
album = data.data;
},
error: function (jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
}
});
});