javascript - Js fetch api post undefined as value not string
one text
Solution:
There are different ways to check the data before set:
- !!objData.kenuze (for check the Truthy and Falsy)
- ??objData.Kenuze (for check is Null or not)
- typeof objData.kenuze !== 'undefined' (note that typeof return String as response)
and finally, need to check with some if statement:
if (!!objData.kenuze) {
formdata.append('keuze', objdata.keuze);
}
Source