122
rated 0 times
[
124]
[
2]
/ answers: 1 / hits: 15722
/ 12 Years ago, tue, november 20, 2012, 12:00:00
For some reason this doesnt work and I can't find a way to make it work!
on my controller named ExplicacaoController I have this:
public function accessRules()
...
'actions'=>array('index','view', 'test', 'ajaxrequest'),
...
public function actionAjaxRequest()
{
$val1 = $_POST['val1'];
$val2 = $_POST['val2'];
echo something;
Yii::app()->end();
}
On my view I have:
<script type=text/javascript>
...
$.ajax({
type: POST,
url: <? echo Yii::app()->createUrl('explicacaoController/ajaxRequest'); ?>,
data: {val1:1,val2:2},
success: function(msg){
alert(Sucess)
},
error: function(xhr){
alert(failure+xhr.readyState+this.url)
}
});
...
What happens is that I allways get this error:
failure4<? echo Yii::app()->createUrl('explicacaoController/ajaxRequest'); ?>
I really need some help with this
More From » php