As a relative noob to the realm of jQuery and Ajax. I've been beating
my head into a brick wall trying to figure out a problem I'm having.
I have a simple checkbox within a view
<div class="setReview" id="<?php echo $b['Request']['id']; ?>">
<?php
echo $html->checkbox('Request/review_id', null,
array('1'=>
'Ready', 'class' => 'review'));
?>
</div>
I want jQuery to capture both the Request id and the Review id via
Ajax
$(document).ready(function() {
//ADD ONCLICK HANDLER TO CHECKBOX WITH class
$("input:checkbox").click(function() {
//var value = $(this).val(); //VALUE OF CHECKBOX
if ($('.review').attr('checked')) {//CONFIRM IF CHECKED
$.post('/permits/permits/setReview', {//SEND POST MSG
setReview
method not receiving value. STUCK HERE
id : "data[Request][id]",
name : "data[Request][review_id]",
}, function(msg) {
alert("Value is: " + msg);//RETURN MESSGAGE
});
}
});
});
Then take that information and pass it to a controller
function setReview(){
if(empty($this->data)){
$r = $this->data['Request']['review_id'];
$this->Request->id = $this->data['Request']['id'];
$this->Request->saveField('review_id', $r);
$this->set('ready', $r);
}
}
Simple concept that isn't working. I keep getting undefined values
every time I make the Ajax call.
Any suggestions are greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---