The following error TypeError: 'append' called on an object that does not implement interface FormData.
is being sent to the console log and refers to the line $.ajax({
as per script below.
The error is not clear to this reader, as upon consulting the documentation, there are at least 3 components with Type
as well as settings which could set custom types.
document.getElementById('startButton').addEventListener('click', () => {
codeReader.decodeFromVideoDevice(selectedDeviceId, 'video', (result, err) => {
if (result) {
console.log(result)
document.getElementById('result').textContent = result.text
let formData = new FormData();
let CodeParams = {
code_data: result.text
};
formData.append("code_json_data", JSON.stringify(CodeParams));
$.ajax({
url: "update",
type: "post",
data: formData
});
}
if (err && !(err instanceof ZXing.NotFoundException)) {
console.error(err)
document.getElementById('result').textContent = err
}
})
console.log(`Started continous decode from camera with id ${selectedDeviceId}`)
})
What is incorrect with the declaration of FormData
?