[eluser]1mr3yn[/eluser]
hey guyz.,. I encountering a problem with my new project which uses codeigniter, ajax and jquery.,.
I have a list of clients from a loop., and everytime a user clicked one client a dialog form will show with the details of the selected clients. and that details is from the database, my codes only works on the first list.,
the loop;
Code:
//start foreach
<a href="" class="client_details">
<input type="hidden" value="<?=$code?>" class="hidden_client"/>
<?=$member_name; ?>
</a>
//end foreach
================================
the script:
Code:
$('.client_details').click(function(e) {
e.preventDefault();
$('#dialog').dialog('open');
var client = $('.hidden_client').val();
$('.box').load("<?= base_url().'controller/method' ?>",{code: client});
return false;
});
<*******************************>
the Controller
Code:
$cid = $_POST['code'];
$this->db->where('code = ', $cid);
$query = $this->db->get('table');
$result = $query->result();
foreach( $result as $field ) {
//variables
}
$this->load->view('client_details',$data);
+++++++++++++++++++++++++++++++++++
Everytime I click any of the list., I always got the detail of the first list.
Thanks!!!