0

I want to know how to enter the onchange () result value into the select option, then make it an option

I have a database value, namely REGULAR PACKAGE with a value of 3000 and the value of the package YES 12000 results. I want to enter this value into the select option

javascript

 <div class="form-group col-md-3">
              <label for="inputEmail4">TARIF REGULER</label>
              <input type="text" name="" class="form-control" id="tarif" placeholder="">
            </div>

$(document).ready(function(){
      $('#kec_order').change(function(){
          var id=$(this).val();
          $.ajax({
              url : "<?php echo base_url();?>order/get_tarif",
              method : "POST",
              data : {id_tarif: id},
              async : false,
              dataType : 'json',
              success: function(data){  
              $('#tarif').val(data[0].reguler);
              }
          });
      });
  });

//result value 12000

and I want to enter a value ('#tarif') into the select option

div class="form-group col-md-3">
                <label for="pakey">Pilih paket</label>
                <select class="form-control" name="paket" id="pilihpaket">
                    <option >Paket Reguler</option>
                    <option value="">Paket Yes</option>
                </select>
            </div>
Lutfi y
  • 7
  • 3

0 Answers0