I need to use booleans within form data. For example:
let example = new FormData();
example.append('aBoolean', true);
This throws and error as the above 'true' needs to be in string form. Do you know a way I can use booleans within FormData? Alternatively even a way to cast it as a boolean when I get the value by:
example.get("aBoolean")
Assuming i did store the true as a string in the above example.
Well you cannot set Boolean into FormData
append method. Only allow datatype are USVString,Blob
.
Read more about it from mdn documentation
https://developer.mozilla.org/en-US/docs/Web/API/FormData/append
https://developer.mozilla.org/en-US/docs/Web/API/USVString
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With