On Dec 14, 2006, at 10:50 AM, luis_y27 wrote:
> thanks for your quick response John, I already have set up a
> controller
> action to respond to the ajax request. Also all necessary .js files
> are
> included in my code. I tried your suggestion and it worked but only
> partially thought. Mostly because I might not understand how the ajax
> call is received and how the division should be updated. My onchange
> code is as follow
> onchange="new Ajax.Updater('rate_groups_div',
> 'rate_groups/getRateGroups/?accountid=' + this.value);"
You might change the URL to:
'/rate_groups/getRateGroups/'+ this.value
(notice the leading slash, and the change from GET params to Cake URL
params)
> on the controller I do the following to process the information that I
> need depending on the accountid
>
> function getRateGroups() {
> $accountid = ( isset($_GET['accountid']) ) ? $_GET['accountid']
> :
> $_SESSION['User']['accountid'];
> $rg_groups = $this->RGPanel->getRateGroups($accountid);
> $this->set('results', $rg_groups );
> }
And the action to:
function getRateGroups($value == false) {
$this->layout = 'ajax';
$accountid = ( $value ) ? $value : $_SESSION['User']['accountid'];
$rg_groups = $this->RGPanel->getRateGroups($accountid);
$this->set('results', $rg_groups );
}
(the value is passed to the first param of the action, and the layout
is set to ajax, an empty layout)
> I'm using HTTP headers and I see that I'm able to get the results from
> the call to RGPanel->getRateGroups($accountid) but instead of updating
> my division the browser throws the following error
>
> You are seeing this error because the view
> /var/www/html/CallRating/app/views/rate_groups/get_rate_groups.thtml
> for action getRateGroups in controller RateGroups could not be found.
Do you have a view file for this action at /app/views/rate_groups/
get_rate_groups.thtml?
In that view, you'll need the markup you want stuck in your div after
the AJAX call.
-- John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---