Without seeing what your BASE does (I expect var BASE = "{{ URL::to('/') }}";
or something similar).
Shouldn't you need to add admin
to the $.post
URL?
$.post( BASE + "/admin/insights/marktinfo/verwerkdata" );
Edit: Do check if BASE is http://example.com
or http://example.com/
. If the second:
$.post( BASE + "admin/insights/marktinfo/verwerkdata" );
My consoles says: "Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://mywebite.com/admin/insights/marktinfo/verwerkdata up"
So /admin has already been added
Can you pull the 500 error from the logs?
Also, are you protecting your POST routes with the CSRF filter but not sending that with your AJAX request?
alainbelez said:
could you post TestController?
<?php
class TestController extends BaseController {
public function index() {
return 'test';
}
}
The controller does work with a normal submit button in a form...
kreitje said:
Can you pull the 500 error from the logs?
Also, are you protecting your POST routes with the CSRF filter but not sending that with your AJAX request?
This is what laravel logs tells me:
[2014-02-12 09:21:09] log.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /var/www/project/app/filters.php:112
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(159): call_user_func_array(Object(Closure), Array)
#2 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(262): Illuminate\Routing\Route->callFilter('csrf', Object(Illuminate\Http\Request), Array)
#3 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(185): Illuminate\Routing\Controllers\Controller->callFilter(Object(Illuminate\Routing\Route), 'csrf', Object(Illuminate\Http\Request))
#4 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(109): Illuminate\Routing\Controllers\Controller->callBeforeFilters(Object(Illuminate\Routing\Router), 'index')
#5 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(985): Illuminate\Routing\Controllers\Controller->callAction(Object(Illuminate\Foundation\Application), Object(Illuminate\Routing\Router), 'index', Array)
#6 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#7 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(80): call_user_func_array(Object(Closure), Array)
#8 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(47): Illuminate\Routing\Route->callCallable()
#9 /var/www/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1016): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#10 /var/www/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(530): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#11 /var/www/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(506): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#12 /var/www/project/public/index.php(49): Illuminate\Foundation\Application->run()
#13 {main} [] []
And no I'm not using a CSRF filter
That error seems to indicate that the CSRF filter. Are you sure you don't have a CSRF filter on your route?
It seems he has -> filters.php line 112 ;)
Jup you guys were right... It was because of the CSRF.. Well its weird because I'm using it so far I know.. Thanks anyways
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community