开发者

how can i get data from other browser without refreshing browser in cakephp?

开发者 https://www.devze.com 2022-12-11 09:30 出处:网络
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.

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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消