Problem: All methods of FormData do not work/compatible with Internet Explorer. The only method that is successful is 'append'. but suppose you want to override values of specific keys but in that scenarios 'set' and 'delete' methods will not work on Internet Explorer.
Solution: You may use below code that will work on IE.
var form = $('form')[0];
var formData = new FormData();
var inputs = form.getElementsByTagName('input'); //for input box
var inputsList = Array.prototype.slice.call(inputs);
inputsList.forEach(
function (i) {
if (i.name !== 'excludedName') {
formData.append(i.name, i.value);
}
}
);
formData.append('excludedName', 'value you want to set');
Note: for 'select' and 'textarea' use:
var selects = form.getElementsByTagName('select');
var textareas = form.getElementsByTagName('textarea');
Solution: You may use below code that will work on IE.
var form = $('form')[0];
var formData = new FormData();
var inputs = form.getElementsByTagName('input'); //for input box
var inputsList = Array.prototype.slice.call(inputs);
inputsList.forEach(
function (i) {
if (i.name !== 'excludedName') {
formData.append(i.name, i.value);
}
}
);
formData.append('excludedName', 'value you want to set');
Note: for 'select' and 'textarea' use:
var selects = form.getElementsByTagName('select');
var textareas = form.getElementsByTagName('textarea');
0 comments:
Post a Comment