nope not the Bosstones' song but my AJAX response.
I have a button on the page. Clicking the button invokes the following
jQuery function:
$('#refresh_sub').click(function()
{
console.log('Start');
// Add the content to the dialog
$.post("/subscribers/refresh_sub", '', function(data){
console.log('Finish');
populate_dialog(data);
$("#confirm_dialog").dialog('option', 'buttons', {
'OK': function()
{
$("#confirm_dialog").dialog('close')
}
});
$('#confirm_dialog').dialog('open');
}, 'json');
});
Which in turn invokes the following PHP method in my Subscribers
Controller:
public function refresh_sub($id = null)
{
/*
* <PerformSubOp>
* <SubscriberId> subscriber_id </SubscriberId>
* <Operation> operation </Operation>
* </PerformSubOp>
*/
$this->layout = 'ajax';
$operation = $this->data['operation'];
$id = $this->data['Subscriber']['SubscriberId'];
$this->TransactionParams['transaction']['id'] . $operation;
$this->TransactionParams['transaction']
['TransactionCommandList']['TransactionCommand']['PerformSubOp']
['SubscriberId'] = $id;
$this->TransactionParams['transaction']
['TransactionCommandList']['TransactionCommand']['PerformSubOp']
['Operation'] = $operation;
$result = $this->Subscriber->query('SendTransaction', $this-
>TransactionParams);
$this->set('response', json_encode( array ('title'=>'Success',
'message'=>'Message content', 'level'=>'Success')));
}
The view then does this:
<?php echo $response; ?>
Pretty standard stuff. However my jQuery function never gets the data
back. If you look you will see I have two console.log() calls the
jQuery function. The first one fires but the second does not.
I know that the json data is being returned because I can see it in
the HTTP response in Firebug.
This basic transaction works in my custom framework. But I am moving
over to Cake and I am wondering where I went wrong.
Thanks for any help.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---