this code doesnt save data in db as 1 when i click on yes button..
<table id="main" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>Date</th> <th>Amount</th> <th>Approve</th> </tr> </thead> <tbody> <?php
$i= 0;
foreach($purchaseorder as $tdata):
$i++;
?> <tr> <td><?php echo $tdata['pay_date']; ?></td> <td><?php echo $tdata['amount']; ?></td> <td><td><?php if ($tdata['approve']=='1')
{ ?> <input type="button" onClick="save(this);" value="Yes"> <input type="button" onClick="save(this);" value="No"> ?></td> </tr> <?php
endforeach;
?> <script>
function save(this){
$.ajax({
type: "POST",
url: "Marketing/index.ctp",
data: {status: this.value},
success: function(data) {
alert("Ajax save executed!");
}
});
}
</script>