Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. html += '<input type="text" name="product_barcode" id="product_barcode" placeholder="barcode" class="form-control" />';
  2. html += '</div>';
  3. '''
  4.  
  5. $(document).on('change','#product_barcode',function(){
  6. var barcode = document.getElementById('product_barcode').value;
  7.  
  8. $.ajax({
  9. url:"barcode_action.php",
  10. method:"POST",
  11. data:{barcode:barcode},
  12. dataType:"json",
  13. success:function(data)
  14. {
  15.  
  16. var data1=(JSON.stringify(data.product_name));
  17. var data2=(JSON.stringify(data.price));
  18. data1=data1.split('"').join('');
  19. data2=data2.split('"').join('');
  20. $('#product_info input[name="product_name[]"]').val(data1);
  21. $('#product_info input[name="price[]"]').val(data2);
  22.  
  23. }
  24. }) ;
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement