javascript - ajax with function value in codeigniter -


i need work ajax function value. have label instance "id=36" onclick in html:

id="<?=$row['customer_id'];?>" onclick="test(this.id)"> 

now need work trough it. java script code:

<script type="text/javascript">     function test(clicked_id) {             var value = { 'id' : 36; };         $.ajax({             type: 'post',             url: '<?php echo site_url('test/ret(id)'); ?>',             data: value,             success: function(resp) {                 $('#data').html(resp);             }         });     } </script> 

i know wrong!!! what?! id correct how can send , use in java script? var value doesn't 'id' , think

 url: '<?php echo site_url('test/ret(id)'); ?>' 

is incorrect! how can send id trough function?

<script type="text/javascript"> function test(clicked_id) {          $.ajax({         type: 'post',         url: '<?php echo site_url('test'); ?>',         data: { id: clicked_id },         success: function(resp) {             $('#data').html(resp);         }     }); } 

and on page using

$id = $_post['id']; 

Comments