javascript - Eror 500 with ajax and codeigniter -


i have problem calling ajax on view on codeigniter website. ajax calling method in controller on same project. have ajax search, work correctly. when chose 1 of results, open new tab , show me detail information database. in cases when click on results(i didn't find rule when happening), ajax return me 500 error, without go controller method, when refresh page (f5) shows me correct result. did have same problem, or can me fix it? here ajax call:

<script> $(document).ready(function() {     $.ajax({         type: 'post',         url: '<?=site_url('index/ajax_read_details')?>',         datatype: 'json',         cache: false,         async:true,         data: {'param':'<?=$selected?>'},         beforesend: function (xhr) {             $('#loading').show();         },         success: function (data) {             $('#loading').hide();                 var details = '<tr>' +                     '<td>'+data['title']+'</td> '+                     '<td>'+data['code']+'</td>' +                     '</tr>';                 $('#data >tbody').append(details);             })         },         error: function(jqxhr, textstatus, errorthrown){             alert('error: '+ errorthrown);         }     }); }); </script> 

i know didn't go controller method "ajax_read_details" in index controller in case when give me 500 error.but when refresh, go method , correctly job. in both cases, send same values in first didn't return values, after refresh page give me values :(

short controller method is:

public function ajax_read_details() {     $param = $this->input->post('param');      echo json_encode(array('title' => $param, 'code'=>param)); } 


Comments