When the user first goes on website on the index route I will get the user's timezone.
I have an ajax request on my index.blade.html file at the route. "/"
I am posting the ajax route to this route "/custom_sessions".
error im getting
jquery-1.12.4.min.js:4 POST http://127.0.0.1:8000/custom_sessions 500 (Internal Server Error)
// route the ajax is hitting
Route::post('/custom_sessions', 'CustomSessionsController@store');
-
// controller
class CustomSessionsController extends Controller
{
public function store()
{
// when i remove this line the ajax request is successful with no errors in the console
session('timezone' => $request('timezone'));
}
}
-
// have this in my head in my html
<meta name="csrf-token" content="">
-
// ajax script at the bottom of my index.blade.php file
$.ajax({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
type: "POST",
url: "/custom_sessions",
data: {
"timezone": "PST"
}
});
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2FD1NrQ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire