I am currently working on integrating a QR scanner into my PhoneGap app using the BarcodeScanner plugin from PhoneGap Build. However, I am facing an issue where the app freezes after completing a scan and triggering an alert.
The JavaScript code involved is as follows:
var options=""
options += '<p>'+formData["form"][formPart][1]+'</p>'
options += '<a data-role="button" data-rel="dialog" formPart="'+formPart+'"id="Cap-'+formPart+'">Capture Image</a>'
options += '<p id="Cap-Data"></p>'
$('#formContent').append(options);
$('#Cap-'+formPart).on("tap",function(event){
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan(
function (result) {
var FP = $(this).attr("formPart");
$('#Cap-Data').html(result.text);
alert(result.text);
},
function (error) {
alert("Scanning failed: " + error);
}
);
});
Any assistance with resolving this issue would be greatly appreciated.