logo
Tags down

shadow

jquery ajax oncomplete


By : Wallero Tech
Date : May 06 2020, 08:30 AM

I trying to do barcode scanning just from html code to get exact data from same as what i got in notepad.

$(document).scannerDetection({

    timeBeforeScanTest: 200, // wait for the next character for upto 200ms
    avgTimeByChar: 40, // it's not a barcode if a character takes longer than 100ms
    preventDefault: true,
    endChar: [7],

    $("#userInput").onComplete(function(){ //i got error here.. why?
    validScan = true;

    alert("Job Start");
    var text = $(this).text();
    var barcode = text.substring(1,4);
    $('input[type="text"]').val(barcode);
    )};
    //  } // main callback function ,
    //,
    //onError: function(string) {

    //$('#userInput').val ($('#userInput').val()  + string);

    //}

});
</script>
</head>
<body> 
    <p><strong> Scan BarCode : </strong></p>
    <input id="userInput" type="text" autofocus readonly/><br/><br/><br/>

    <p><strong> BarCode : </strong></p>
    <p> <input type="text" readonly/></p><br/><br/><br/>

    <p><strong> Zone : </strong></p>
    <p> <input id="zone" type="text" readonly/></p><br/><br/><br/>  

</body>
</html>`

i got issue in line 16... the way i wrote onComplete function is false.

Answer :

As your suggested function() is not closed properly and try to read the below source on how to use oncomplete function

https://a.kabachnik.info/jquery-scannerdetection-tutorial.html

$("#userInput").onComplete(function(){ //i got error here.. why?
    validScan = true;

    alert("Job Start");
    var text = $(this).text();
    var barcode = text.substring(1,4);
    $('input[type="text"]').val(barcode);
 });


<script type="text/javascript" src="your_path/jquery.scannerdetection.js"></script>
<script type="text/javascript">
$(document).scannerDetection({
    timeBeforeScanTest: 200, // wait for the next character for upto 200ms
    startChar: [120], // Prefix character for the cabled scanner (OPL6845R)
    endChar: [13], // be sure the scan is complete if key 13 (enter) is detected
    avgTimeByChar: 40, // it's not a barcode if a character takes longer than 40ms
    onComplete: function(barcode, qty){ ... } // main callback function 
});
</script>


Share : facebook icon twitter icon
Related Posts Related Posts :
  • clear array after form submit
  • pass url variable to javascript
  • access data using api
  • div position fixed css
  • add horizontal line between two div
  • disable toggle button css
  • css fixed line height
  • background image not working
  • table cell border
  • text line break css
  • overlay div on div
  • text direction rtl css
  • javascript convert string to an object
  • bind inner div click to outer div
  • how to use promise in for loop
  • jquery get element using variable
  • javascript send textbox value
  • pass div class content to another class or id
  • css new line after element
  • css calc not working properly
  • link disabled jquery
  • sql join table to subquery
  • MS Access SQL Issue with OR AND Operators
  • set textarea value using php
  • php merge two arrays into one
  • php form with google captcha
  • update current row in php
  • php date format mysql
  • mysql pdo select query
  • php function return an array
  • PHP mysqldump database to sql file
  • display image query
  • php create array using foreach loop
  • associative array php
  • group_concat in mysql laravel
  • php array_push empty
  • mysql on update cascade not working
  • pdo insert prepared statement
  • mysql insert ignore vs on duplicate key
  • mysql insert into existing row
  • mysql multi insert query
  • mysql group by show all rows
  • php change profile image
  • combine multiple arrays into one array php
  • how to sum values in an array
  • how to get sum of the total time
  • How to Create Facebook live stream without notification using API ?
  • on button click make div visible
  • css affect another element on hover
  • insert line after paragraph word
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org