I need to send data from ajax to controller
some body help me to modified code
this ajax code
ajax.js
function loadtooltip(obj, $user_id) {
     //AJAX
     var req = Inint_AJAX();
     req.onreadystatechange = function () {
          if (req.readyState==4) {
               if (req.status==200) {
                    displaytooltip(obj, req.responseText);
               }
          }
     };
     //���ҧ connection
     req.open("POST", "http://127.0.0.1/cakeplate/tooltips/tooltip/$user_id";,
true);
     req.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
     req.send($user_id); //�觤��
};

this controller
<?php
Class TooltipsController extends AppController{
    var $name = 'Tooltips';
    var $uses = array('Reply','User');
    var $component = array('RequestHandler','Javascript','Ajax');
    var $layout =  'tooltip';


    function tooltip($user_id=NULL){

                    if(!empty($user_id)){
                        $tooltip = $this->Reply->User->findById($user_id);
                        $this->set('tooltip',$tooltip);
                    }

    }
}
?>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to