URLs are absolute not relative to the app
cornernote opened this issue · 0 comments
cornernote commented
You have code like this in the JS
$.post('/supervisor/default/supervisor-control', {
actionType: actionType
}, responseHandler);
The problem is this takes you to an absolute URL.
Perhaps you can init the JS like this:
$view->registerJs('var supervisorManager = ' . Json::encode([
'urls' => [
'supervisorControl' => Url::to(['/supervisor/default/supervisor-control']),
'processControl' => Url::to(['/supervisor/default/process-control']),
...
],
]) . ';');
Then change the JS to:
$.post(supervisorManager.urls.supervisorControl, {
actionType: actionType
}, responseHandler);