How to pass an id in cakephp to ajax form?

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
devilinc
Forum Newbie
Posts: 16
Joined: Fri Nov 12, 2010 1:07 am

How to pass an id in cakephp to ajax form?

Post by devilinc »

implementing a search functionality with ajax helper...now how do i pass an id present in an array in my ctp file to this search box also present in the same ctp file???i use ajax for search...i need to pass it so that the search function in the controller gets this id as its argument?
endyourif
Forum Newbie
Posts: 7
Joined: Wed Jan 26, 2011 6:53 pm

Re: How to pass an id in cakephp to ajax form?

Post by endyourif »

Depends on how you've implemented AJAX. Below are two tutorials I've created that describe different ways:

http://www.endyourif.com/how-to-add-com ... n-cakephp/
http://www.endyourif.com/drag-and-drop- ... h-cakephp/

The first example uses $ajax->submit() which will serialize the form and post it via AJAX.

The second example uses Jquery and the post data is manually built and sent with Javascript via AJAX.
Post Reply