Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- html += '<input type="text" name="product_barcode" id="product_barcode" placeholder="barcode" class="form-control" />';
- html += '</div>';
- '''
- $(document).on('change','#product_barcode',function(){
- var barcode = document.getElementById('product_barcode').value;
- $.ajax({
- url:"barcode_action.php",
- method:"POST",
- data:{barcode:barcode},
- dataType:"json",
- success:function(data)
- {
- var data1=(JSON.stringify(data.product_name));
- var data2=(JSON.stringify(data.price));
- data1=data1.split('"').join('');
- data2=data2.split('"').join('');
- $('#product_info input[name="product_name[]"]').val(data1);
- $('#product_info input[name="price[]"]').val(data2);
- }
- }) ;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement