Answer the question
In order to leave comments, you need to log in
Why doesn't Yii2 paired with jQuery (aJax) work?
AJax request not working, what could be the reason?
We connect in views:
$script = <<< JS
$.ajax({
url: 'mysite.ru/site/message',
success: function(data) {
alert(data);
}
});
JS;
$this->registerJs($script, yii\web\View::POS_READY);
public function actionMessage()
{
echo 'Проба';
}
Answer the question
In order to leave comments, you need to log in
Trace this code (and the jQuery include code) in the resulting html code of the page to begin with.
Well, look in Firebug or something - is Ajax knocking here - mysite.ru/site/message
does the url line bother you?
I think your script is trying to get data from domen.com/mysite.ru/site/message
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question