1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

insert data in mysql database when bar code scanner scan any bar code with ajax

Discussion in 'PHP' started by dineshsingh1984, Oct 20, 2014.

  1. #1
    i want to automatic insert data in database when bar code scanner scan any bar code with ajax
    plz help me...........
     
    dineshsingh1984, Oct 20, 2014 IP
  2. malky66

    malky66 Acclaimed Member

    Messages:
    3,996
    Likes Received:
    2,248
    Best Answers:
    88
    Trophy Points:
    515
    #2
    Are you taking on jobs and just coming here and asking people to do it for you?
    Try Googling and finding out how to do it yourself instead of expecting other people to do your work for you, We don't mind helping people out but you just come here and start thread after thread, You don't even say thanks when people help you out, I think you're just taking the piss.
     
    malky66, Oct 20, 2014 IP
  3. dineshsingh1984

    dineshsingh1984 Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    hello sir,
    It's not a entertainment site i am search on google and find some script and using this but it's not working.
    find the code on google :
    <script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
    $('#theBarcode').keyup(function(e){
    barcode = $(this);
    // if Enter key was pressed, send the barcode to backend
    if( (e.keyCode == 13) && (barcode.val().length > 10)){
    sendBarcode(barcode.val());
    // clear the input
    barcode.val('');
    }
    });
    });
    function sendBarcode(b){
    $.post("r.php",{ barcode: b },
    function(data){
    if(data.status=='success'){
    $('#display').html(data.content);
    } else {
    $('#display').html(data.message);
    }
    }, "json");
    }
    </script>
    other script

    $(document).ready(function(){
    $("#bcode").focus();//prevents autocomplete in some browsers
    $("#bcode").attr('autocomplete','off').keyup(function(event){
    var name = $("#bcode").val();
    $("#status").empty();if(name.length >17)`// need to check all possible length values like this`{
    selectAll();
    $("#status").html('<img align="absmiddle" src="images/loading.gif" /> Checking availability...').show();
    $.ajax({
    type:"POST",
    url:"namecheck.php",
    data :"bcode="+ name,
    success:function(msg){
    $("#status").html(msg).show();}});
    }else{
    $("#status").html('').addClass('err').show();}});});

    and other two script find and also do RND but i'm not success. so i'm post this thread.........
     
    dineshsingh1984, Oct 20, 2014 IP
  4. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #4
    I agree.

    This question is also very hard to answer, it's not clear how you are scanning the code and do you even understand what the code above says?

    Maybe you didn't load jQuery, that would be one reason why its not working.
     
    Anveto, Oct 20, 2014 IP
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    Also - to get the barcode automatically posting, you'd need to have a check on an input or textarea to see if it's empty or not, and then post it automatically if it's not. However, and this is important, unless you're ABSOLUTELY SURE that there will never be, for instance, someone typing something in the box, it might end up with the wrong information in the database. Also, you should do a check or something for existing entries - or you'll get double listings if you accidentally scan the code multiple times - it happens, believe me.
     
    PoPSiCLe, Oct 20, 2014 IP