tags:

views:

88

answers:

2

i am new to cakephp, and also new to ajax.

the function i trying to do is basically like this: i am in a add page, which let me select few customer on that page. but i wanted to set 1 more link for user, which let user click customer immediately on the add page, and the new data will show in my add page without refresh, so that the user can choose the new added customer for enter my form.

i know the idea is base on using ajax. but i am still new to it and hope any 1 can give some comment or suggestion how can i start??

the problem i face is, i am on a form, when i adding a new customer in the form, i wanted to get the new customer to show in my form without refresh. what can i do for getting this function?

thanks a lot and i will very appreciate your answer.

A: 

easiest way is to use a javascript library (like jquery for instance) to do an ajax request. probably to a controller/action in your cake framework.

the easiest way would probably be returning the data in JSON and filling out your form fields.

PHP Json
jQuery AjAX/JSON

Nicky De Maeyer
+3  A: 

CakePHP has an ajax helper, which requires the prototype library. You can find the API for the AJAX helper here:

http://api.cakephp.org/class/ajax-helper

And a guide to using the helper here:

http://book.cakephp.org/view/208/AJAX

And a list of cakephp/ajax articles here:

http://bakery.cakephp.org/articles/search/tags/ajax

It's beyond the scope of a Stack Overflow answer to give you a tutorial but hopefully these links will help.

James Booker
ok thanks.. it's really help me a lot... !!
vincent low