Oops! I finally got it.
In my view, the key to use $ajax->submit function is to understand
what's the '/controller/function'.
In my project, I use $ajax->link to update a edit function without
refreshing. And i use $ajax->submit to update a form information.
There is a checkling list for this:
1.make the $ajax-submit works fine in views/edit.thtml.
<form onSubmit="return false;"></form>
<div class="submit">
<?php echo $ajax->submit('Save',
array('url' => '/posts/update',
'update'=>'index'));?> .....(make a div named index to show the
result of list of posts in views/index.thtml
file.)
</div>
Notice the '/controller/function'. For my project I use
'/posts/update'
P.S. Update is new function in my posts_controller.php to save editing
,submit and then render to posts/index
2.make new function in my posts_controller.php like:
function update()
{
$this->Post->save($this->data);
$this->set('posts', $this->Post->findAll());
$this->render('index','ajax');
}
Hopes it will make some helps to rookies like me who loves cake!!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---