I have an html with a script that is like so (btw, HAVe to use old fashioned post in my html for reasons)...
@extends('layout')
// ... includes for jquery and ajax
<script>
var theVariableINeedInLaravel = "SomeInterestingStringI'mSure"; // in reality, this is a stringify.
$.post ("foo", function(theVariableINeedInLaravel) {
}
</script>
@stop
Then in routes.php...
<?php
Route::post('foo', 'ThatOneController@getValue');
?>
Then, in the related controller.... ThatOneController.php
class ThatOneController extends \BaseController{
public function getValue(){
error_log(print_r($_POST,true)); // returns nothing.
error_log(print_r(input::all()); // returns nothing.
}
}
Or, an alternate version of the function...
public function getValue(Request $request){
error_log(print_r($request->all()); // returns nothing.
}
None of them seem to work. How can I get my post variable?