supervisor-manager icon indicating copy to clipboard operation
supervisor-manager copied to clipboard

URLs are absolute not relative to the app

Open cornernote opened this issue 8 years ago • 0 comments

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);

cornernote avatar Jan 04 '17 01:01 cornernote