Question

I'm having problems with an ajax call on the server. This is my full routes.php file:

<?php
$app->post('translations/get/trans', 'Translations\Controller\IndexController::ajaxGetTagsTranslations')->bind('translations.gettrans');

$app->get('/{_locale}/dashboard', 'Dashboard\Controller\IndexController::indexAction')->bind('dashboard.index');

$app->match('/api/todo/{user}/{accessKey}', 'Api\Controller\IndexController::todoAction')->method('POST|GET');
$app->match('/api/getdailymessage/{user}/{accessKey}', 'Api\Controller\IndexController::getDailyMessageAction')->method('POST|GET');
$app->match('/api/todo/out', 'Api\Controller\IndexController::todooutAction')->method('POST|GET');
$app->match('/api/finisharea', 'Api\Controller\IndexController::finishAreaAction')->method('POST|GET');
$app->match('/api/activity', 'Api\Controller\IndexController::activityAction')->method('POST|GET');
$app->match('/api/supplier', 'Api\Controller\IndexController::suppliersAction')->method('POST|GET');
$app->match('/api/translations', 'Api\Controller\IndexController::translationsAction')->method('POST|GET');
$app->match('/api/serverdatetime', 'Api\Controller\IndexController::serverDateTimeAction')->method('POST|GET');
$app->match('/api/dailymessage', 'Api\Controller\IndexController::dailyMessageAction')->method('POST|GET');
$app->match('/api/settings', 'Api\Controller\IndexController::settingsAction')->method('POST|GET');
$app->match('/api/providedby', 'Api\Controller\IndexController::providedByAction')->method('POST|GET');
$app->match('/api/presentations', 'Api\Controller\IndexController::presentationsAction')->method('POST|GET');
$app->match('/api/login', 'Api\Controller\IndexController::loginAction')->method('POST|OPTIONS|HEAD|GET');

$app->get('/{_locale}/hosts/list', 'Hostess\Controller\IndexController::listAction')->bind('hosts.list');
$app->match('/{_locale}/hosts/detail/{id}/{range}', 'Hostess\Controller\IndexController::detailAction')->method('GET')->bind('hosts.detail');
$app->match('/{_locale}/hosts/edit/{id}', 'Hostess\Controller\IndexController::editAction')->method('GET|POST')->bind('hosts.edit');
$app->post('/hosts/gethosts', 'Hostess\Controller\IndexController::ajaxGetHosts')->bind('hosts.gethosts');

$app->get('/{_locale}/segments/list', 'Segments\Controller\IndexController::listAction')->bind('segments.list');
$app->get('/{_locale}/segments/view/{id}', 'Segments\Controller\IndexController::viewAction')->bind('segments.view');
$app->match('/{_locale}/segments/edit/{id}', 'Segments\Controller\IndexController::editAction')->method('GET|POST')->bind('segments.edit');
$app->post('/segments/order', 'Segments\Controller\IndexController::ajaxUpdateOrderAction')->bind('segments.order');
$app->post('/segments/getsegments', 'Segments\Controller\IndexController::ajaxGetSegments')->bind('segments.getsegments');

$app->post('/segments/gethosts', 'Segments\Controller\IndexController::ajaxGetHostsSegment')->bind('segments.gethosts');
$app->post('/segments/updatehosts', 'Segments\Controller\IndexController::ajaxUpdateHostsSegment')->bind('segments.updatehosts');

$app->match('/{_locale}/subarea/edit/{segmentcode}/{deelgebied}', 'Segments\Controller\IndexController::editSubareaAction')->method('GET|POST')->bind('subarea.edit');

$app->get('/{_locale}/presentations/list', 'Presentations\Controller\IndexController::listAction')->bind('presentations.list');
$app->match('/{_locale}/presentations/upload', 'Presentations\Controller\IndexController::uploadAction')->method('GET|POST')->bind('presentations.upload');
$app->post('/presentations/deletepresentation', 'Presentations\Controller\IndexController::ajaxDeletePresentation')->bind('presentations.deletepresentation');

$app->match('/{_locale}/translations/list', 'Translations\Controller\IndexController::listAction')->method('GET|POST')->bind('translations.list');
$app->get('/translations/inserttrans', 'Translations\Controller\IndexController::insertTransJSON')->bind('translations.inserttrans');

$app->match('/{_locale}/settings/list', 'Settings\Controller\IndexController::listAction')->method('GET|POST')->bind('settings.list');

$app->match('/{_locale}/history/index', 'History\Controller\IndexController::indexAction')->method('GET|POST')->bind('history.index');

$app->get('/404', 'Api\Controller\IndexController::indexAction');

I'm having trouble with the first route. What I had first is the following: translations/gettrans but that didn't work. So now I tried translations/get/trans but that didn't do it either. I always get a 404 error (Not found). When I check the routing he can find the route:

enter image description here

But why is this not working?

Was it helpful?

Solution

Long shot, but do you have anything in your .htaccess for friendly urls? This could be screwing it

OTHER TIPS

Did you try adding a slash / in the route? This is the only route without the opening slash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top