Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //controllel
- <?php
- class ajax_eceran extends CI_Controller
- {
- function __construct() {
- parent::__construct();
- $this->load->admin_model('pos_model');
- }
- function ambil_data(){
- $modul=$this->input->post('modul');
- //$product_id=$this->input->post('product_id');
- echo $this->input->post('isi');
- /*if($modul=="eceran"){
- //echo $this->Pos_model->get_harga_eceran($groups_id);
- echo $modul;
- }*/
- }
- }
- //ajax
- $(function(){
- $.ajaxSetup({
- type:"POST",
- url: "<?php echo base_url('ajax_eceran/ambil_data') ?>",
- cache: false,
- });
- $("#groups_eceran").change(function(){
- var value=$(this).val();
- if(value>0){
- $.ajax({
- data:{isi:value},
- success: function(responde){
- $("#grup_h").val(responde);
- //$("#grup_h").attr("placeholder", respond);
- }
- })
- }
- });
- })
- //view
- <div class="form-group" id="tampil_meter">
- <label for="h_eceran" class="col-sm-4 control-label">Pilih Group Harga</label>
- <div class="col-sm-8">
- <?php echo group_eceran('groups_eceran', 'sma_price_groups', 'name', 'id', $groups_eceran); //style="display: none"?>
- </div>
- </div>
- <div class="form-group">
- <label for="grup_h" class="col-sm-4 control-label">Group Harga</label>
- <div class="col-sm-8">
- <input type="text" class="form-control" id="grup_h" name="grup_h" placeholder="Group Harga" value="<?php echo $grup_h; ?>">
- </div>
- </div>
Add Comment
Please, Sign In to add comment