Guest User

Jquery

a guest
Jun 20th, 2018
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ` select: function( event, ui ) {
  2.  
  3. $.ajax({
  4. url: "filter/product_infos",
  5. type: 'get',
  6. dataType: 'json',
  7. data:{'term' : ui.item.value }
  8. }).done(function( product ){
  9.  
  10. if( $.isNumeric( ui.item.value ) ){
  11. //fiz algumas mudan├žas para ver se daria certo
  12. $(this).closest('tr').find('td .form_name_product').val( product.product_name );
  13. $(this).closest('tr').find('td .form_price_product').val( product.product_price.replace('.', ',').replace(/(\d)(?=(\d{3})+\,)/g, "$1.") );
  14.  
  15. }else{
  16.  
  17. $('.form_code_product').val( product.product_code );
  18. $('.form_price_product').val( product.product_price.replace('.', ',').replace(/(\d)(?=(\d{3})+\,)/g, "$1.") );
  19.  
  20. }
RAW Paste Data