Is it possible to set the path for all frontend AJAX request
up vote
1
down vote
favorite
My slugs looks like this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<lang>/<p_page>/<p_category>/<p_product>' => 'splitter/manage-request',
'<lang>/<p_page>/<p_category>' => 'splitter/manage-request',
'<lang>/<p_page>' => 'splitter/manage-request',
'<lang>/' => 'splitter/manage-request',
'<lang>' => 'splitter/manage-request',
'' => 'splitter/manage-request',
],
],
I am sending all the requests to that SplitterController
where I am parsing them. But I don't want the AJAXs to be send to it. Is it possible to give them some default route? To redirect them backend for example. I couldn't find information about it in the documentation? Appreciating links also is I missed it. Thank you!
yii2 yii2-advanced-app
add a comment |
up vote
1
down vote
favorite
My slugs looks like this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<lang>/<p_page>/<p_category>/<p_product>' => 'splitter/manage-request',
'<lang>/<p_page>/<p_category>' => 'splitter/manage-request',
'<lang>/<p_page>' => 'splitter/manage-request',
'<lang>/' => 'splitter/manage-request',
'<lang>' => 'splitter/manage-request',
'' => 'splitter/manage-request',
],
],
I am sending all the requests to that SplitterController
where I am parsing them. But I don't want the AJAXs to be send to it. Is it possible to give them some default route? To redirect them backend for example. I couldn't find information about it in the documentation? Appreciating links also is I missed it. Thank you!
yii2 yii2-advanced-app
not clear, the ajax requests will go on the url you create or assign them. if you dont want your urls to be parsed using the above rules you can add another urlManager component with the nameurlManagerAjax
and the default rules you want, and create the urls for the ajax requests usingYii::$app->urlManagerAjax->createUrl(['controller/action'])
– Muhammad Omer Aslam
Nov 18 at 20:44
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
My slugs looks like this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<lang>/<p_page>/<p_category>/<p_product>' => 'splitter/manage-request',
'<lang>/<p_page>/<p_category>' => 'splitter/manage-request',
'<lang>/<p_page>' => 'splitter/manage-request',
'<lang>/' => 'splitter/manage-request',
'<lang>' => 'splitter/manage-request',
'' => 'splitter/manage-request',
],
],
I am sending all the requests to that SplitterController
where I am parsing them. But I don't want the AJAXs to be send to it. Is it possible to give them some default route? To redirect them backend for example. I couldn't find information about it in the documentation? Appreciating links also is I missed it. Thank you!
yii2 yii2-advanced-app
My slugs looks like this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<lang>/<p_page>/<p_category>/<p_product>' => 'splitter/manage-request',
'<lang>/<p_page>/<p_category>' => 'splitter/manage-request',
'<lang>/<p_page>' => 'splitter/manage-request',
'<lang>/' => 'splitter/manage-request',
'<lang>' => 'splitter/manage-request',
'' => 'splitter/manage-request',
],
],
I am sending all the requests to that SplitterController
where I am parsing them. But I don't want the AJAXs to be send to it. Is it possible to give them some default route? To redirect them backend for example. I couldn't find information about it in the documentation? Appreciating links also is I missed it. Thank you!
yii2 yii2-advanced-app
yii2 yii2-advanced-app
asked Nov 17 at 21:56
Toma Tomov
554216
554216
not clear, the ajax requests will go on the url you create or assign them. if you dont want your urls to be parsed using the above rules you can add another urlManager component with the nameurlManagerAjax
and the default rules you want, and create the urls for the ajax requests usingYii::$app->urlManagerAjax->createUrl(['controller/action'])
– Muhammad Omer Aslam
Nov 18 at 20:44
add a comment |
not clear, the ajax requests will go on the url you create or assign them. if you dont want your urls to be parsed using the above rules you can add another urlManager component with the nameurlManagerAjax
and the default rules you want, and create the urls for the ajax requests usingYii::$app->urlManagerAjax->createUrl(['controller/action'])
– Muhammad Omer Aslam
Nov 18 at 20:44
not clear, the ajax requests will go on the url you create or assign them. if you dont want your urls to be parsed using the above rules you can add another urlManager component with the name
urlManagerAjax
and the default rules you want, and create the urls for the ajax requests using Yii::$app->urlManagerAjax->createUrl(['controller/action'])
– Muhammad Omer Aslam
Nov 18 at 20:44
not clear, the ajax requests will go on the url you create or assign them. if you dont want your urls to be parsed using the above rules you can add another urlManager component with the name
urlManagerAjax
and the default rules you want, and create the urls for the ajax requests using Yii::$app->urlManagerAjax->createUrl(['controller/action'])
– Muhammad Omer Aslam
Nov 18 at 20:44
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53355925%2fis-it-possible-to-set-the-path-for-all-frontend-ajax-request%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
not clear, the ajax requests will go on the url you create or assign them. if you dont want your urls to be parsed using the above rules you can add another urlManager component with the name
urlManagerAjax
and the default rules you want, and create the urls for the ajax requests usingYii::$app->urlManagerAjax->createUrl(['controller/action'])
– Muhammad Omer Aslam
Nov 18 at 20:44