Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

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" );
Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

could you post TestController?

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

That error seems to indicate that the CSRF filter. Are you sure you don't have a CSRF filter on your route?

Last updated 2 years ago.
0

It seems he has -> filters.php line 112 ;)

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ItsRD itsrd Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.