Hi all,
I am trying to send form data and an image file using ajax method, It is working fine when using the submit button. but not working for ajax call. for what reason I did not found.
I trying the below code :
var logo = $('#inputFile')[0].files[0];
var dataModel = {
CompanyName: companyName,
UserPassword: UserPassword,
Languages: selectedLanguages,
DefLanguages: defaultLanguage,
Country:countryName,
CountryId: countryId,
Currency: currency,
}
$.ajax({
type: 'POST',
url: url,
data: JSON.stringify({ objCompany: dataModel, inputFile: logo }),
datatype: "json",
contentType: "application/json; charset=utf-8",
processData: false,
success: function (data) {
alert('success');
},
error: function () {
alert('error');
}
});
Here the dataModel is working perfect ...
Go to the complete details ...