how do i get the user's input value and submit it to ajax then to controller? Right now, in my controller it says that id is an undefined index in $_POST['id']
This input textfield is actually within another form, kind of like a form inside a form.
<?php echo $form->textField($model,'email',array('id'=>'email')); ?>
        <?php echo $form->error($model,'email'); ?>
          <?php echo CHtml::ajaxButton ( 'Request Code', 
                CHtml::normalizeUrl(array('site/requestResetCode', 'render'=>true),
                array (
                    'type' => 'POST',
                    //'data'=> array('id'=> 'js:$("#ResetPasswordForm_email").val()'),
                    'data'=> array('id'=> 'js:$("#email").val()'),
                    'success'=>'function(data){
                        if(data.status == "sent")
                            bootbox.alert("Code is sent. Please check your email.");
                        else (data.status == "failed")
                            bootbox.alert("Request Failure");
                        }',
                    'error'=> 'function (xhr, ajaxOptions, thrownError) {
                        alert(xhr.status);
                        alert(thrownError);
                        }',
                )
            ))
        ?>
controller:
public function actionRequestResetCode()
    {
        $id = $_POST['id'];
//stuff..
 
     
    
array()` – hammies Mar 10 '14 at 12:46