Advertisement
puremindquietheart

Untitled

Sep 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This is my jquery  
  2.  $(document).ready(function(){
  3.       $(document).on('change','#select_promo',function(){
  4.         var price =  $('#show_promo_price').val($("#select_promo option:selected").attr('price'))
  5.         var action = $('#show_promo_action').val($("#select_promo option:selected").attr('action'))
  6.         var action_value = action.val();
  7.         var price_value = price.val();
  8.        
  9.  
  10.           $(document).on('click', '#promoBtn', function(e){
  11.             var model =  $('#show_promo_model').val($("#select_model option:selected").attr('value'))
  12.             var model_value = model.val();
  13.            console.log(action_value);
  14.            console.log(price_value);
  15.    
  16.         });
  17.       });
  18.     });
  19.  
  20. This is my HTML
  21.  
  22.                   <div class="form-group">
  23.                     <label for="select_brand" class="col-sm-3 control-label">Brand Name</label>
  24.                       <div class="col-sm-9">
  25.                         <input type="hidden" class="form-control noBorder" id="show_promo_brand" name="show_promo_brand" readonly disabled>
  26.                         <select id="select_brand" name="select_brand" class="form-control" required>
  27.                          
  28.                           <option selected="" disabled="">Choose brand....</option>
  29.                           <?php
  30.  
  31.                           $conn = $pdo->open();
  32.  
  33.                           $getBrand = $conn->prepare("SELECT * FROM brand
  34.                                                      LEFT JOIN product_model ON brand.brand_id = product_model.brand_id
  35.                                                      LEFT JOIN backup_sales ON backup_sales.model_id = product_model.model_id
  36.                                                      WHERE backup_sales.po_ID = '".$_GET['po_ID']."'
  37.                                                      GROUP BY brand.brand_name");
  38.  
  39.                           $getBrand->execute();
  40.  
  41.                           $getRowsBrand = $getBrand->fetchAll();
  42.  
  43.                           foreach($getRowsBrand as $brand)
  44.                           {
  45.                            echo "
  46.                                  <option id='".$brand['brand_id']."' value='".$brand['brand_id']."'>".$brand['brand_name']."</option>
  47.                                ";
  48.                           }
  49.  
  50.                           $pdo->close();
  51.  
  52.                           ?>
  53.                         </select>
  54.                       </div>
  55.                   </div>
  56.                   <div class="form-group">
  57.                     <label for="select_model" class="col-sm-3 control-label">Model Name</label>
  58.                       <div class="col-sm-9">
  59.                       <input type="hidden" class="form-control noBorder" id="show_promo_model" name="show_promo_model" readonly disabled>
  60.                         <select id="select_model" name="select_model" class="form-control" required>
  61.                         </select>
  62.                       </div>
  63.                   </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement