Hi all!
First of all thanks all for your help, it’s very useful. Im starting with yii and Im a bit lost yet.
I have create a jquery script where I validate a form and then I send it to my controller to work with it and save in the db.
But Im doing it wrong I think I cant connect with my controller. Here is the code:
Jquery script(after all the validate stuff, the variables are fine):
$.ajax({
type: "POST",
url: "<?php echo Yii::app()->request->baseUrl; ?>/proceso/guardarproceso",
data:
{
post_nombre: nombre,
post_empresa: empresa,
post_fechaI: fechaI,
post_fechaF: fechaF,
post_descripcion: descripcion
},
success: function(result)
{
alert(result);
}
});
And my controller ProcesoController:
public function actionGuardarProceso(){
$nombre = $_POST['post_nombre'];
$empresa = $_POST['post_empresa'];
$fechaI = $_POST['post_fechaI'];
$fechaF = $_POST['post_fechaF'];
$descripcion = $_POST['post_descripcion'];
echo $nombre;
}
Im not working with the db yet, I only want to see if I have done it well and the alert(result) shows me the content of $nombre, but instead of that the alert shows me all the html code of the view(yes all xD)
I have done it too:
public function accessRules()
{
return array(
array('allow',
'actions'=>array('index','guardarproceso'),
'users'=>array('*'),
),
);
}
But nothing…
Anyone cuold help me or give me some idea? Thank you all again