Sebuahhobi98

output ajax error

Feb 11th, 2019
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. //controllel
  2. <?php
  3. class ajax_eceran extends CI_Controller
  4. {
  5.  
  6. function __construct() {
  7. parent::__construct();
  8. $this->load->admin_model('pos_model');
  9. }
  10.  
  11. function ambil_data(){
  12. $modul=$this->input->post('modul');
  13. //$product_id=$this->input->post('product_id');
  14. echo $this->input->post('isi');
  15.  
  16. /*if($modul=="eceran"){
  17. //echo $this->Pos_model->get_harga_eceran($groups_id);
  18. echo $modul;
  19. }*/
  20. }
  21.  
  22. }
  23.  
  24. //ajax
  25. $(function(){
  26. $.ajaxSetup({
  27. type:"POST",
  28. url: "<?php echo base_url('ajax_eceran/ambil_data') ?>",
  29. cache: false,
  30. });
  31.  
  32. $("#groups_eceran").change(function(){
  33. var value=$(this).val();
  34. if(value>0){
  35. $.ajax({
  36. data:{isi:value},
  37. success: function(responde){
  38. $("#grup_h").val(responde);
  39. //$("#grup_h").attr("placeholder", respond);
  40. }
  41. })
  42. }
  43. });
  44. })
  45.  
  46. //view
  47. <div class="form-group" id="tampil_meter">
  48. <label for="h_eceran" class="col-sm-4 control-label">Pilih Group Harga</label>
  49. <div class="col-sm-8">
  50. <?php echo group_eceran('groups_eceran', 'sma_price_groups', 'name', 'id', $groups_eceran); //style="display: none"?>
  51. </div>
  52. </div>
  53.  
  54. <div class="form-group">
  55. <label for="grup_h" class="col-sm-4 control-label">Group Harga</label>
  56. <div class="col-sm-8">
  57. <input type="text" class="form-control" id="grup_h" name="grup_h" placeholder="Group Harga" value="<?php echo $grup_h; ?>">
  58. </div>
  59. </div>
Add Comment
Please, Sign In to add comment