Solution:1
HTML Form
Somewhere in the form add the CSRF Token like this
<meta name="csrf-token" content="{{ csrf_token() }}">
Route
Add a post route
Route::post('/path/to/ajax-form-process', 'FormController@processor');
Form process method
class FormController extends Controller{
public function processor(Request $request){
$input = $request->all();
//Do other processes
return '200'; //Use any string that is appropriate
}
}
jQuery Ajax
In your JS/jQuery script add the following
$.ajax({
type: "POST",
url: 'path/to/ajax-form-process',
data: {
data1: 'data1',
data2: 'data2',
data3: 'data3'
},
success: function(html){
console.log(html);
}
});