I need to work with ajax with function value. I have a label for instance with "id=36" which i get by OnClick in html:
id="<?=$row['customer_id'];?>" onclick="test(this.id)">
Now i need to work trough it. my 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 something is wrong!!! But what?! The id i get i correct but how can i send and use it in java script? The var value doesn't get 'id' and i think
url: '<?php echo site_url('test/ret(id)'); ?>'
Is so incorrect! How can i send id trough function?