javascript - lost data after changing variables in php codeigniter -


i confused.. have ajax code throw value of select options, code:

  $('#media-select').on('change',function(){                 var dt = $(this).val();                 alert('media-select='+dt);                 $.ajax({                     type: 'post',                     data: {media : dt},                     url: "<?php echo site_url('admin/uploads/load'); ?>",                     success: function(data){                         $('#result-media-uploader').load(url);                     }                 });             }); 

than output nothing, after checked, wrong on server cause data array.. output print_r();

array( [media] => document) 

this full code in server..

if(!empty($this->input->post()))         {             $media = $this->input->post();             $data['bug'] = print_r($media);             $data['file'] = $this->db->where('post_type','attachment')->where('post_mine_type',$media)->get('cs_posts')->result();             $this->renderblank('admin/pages/uploads/uploads_load',$data);          }else{              $data['bug'] = var_dump($media);             $data['file'] = $this->db->where('post_type','attachment')->where('post_mine_type','image')->order_by('id','desc')->get('cs_posts')->result();             $this->renderblank('admin/pages/uploads/uploads_load',$data);         } 

so, fix code, change variable $media..

$media = $this->input->post('media'); //before change: $media = $this->input->post(); 

please line..

after fix, data sended ajax output null. if dont change $media, data, if change lost data.. please me, thats make me confused.. in advance..!


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -