I'm using laravel 5.5 and I have below code in my controller:
function booking(Request $request)
{
parse_str($request->getContent(), $info);
Session::put('quotation.flight.passengerDetails', $info);
return Session::get('quotation.flight.searchType');
}
This is what i have my route (web.php):
Route::post('ajax/flight/booking', 'Flight\flightController@booking');
This is my ajax
$.ajax({
url: flagsUrl + "ajax/flight/booking",
type: 'POST',
data: opts.bookingData,
contentType: "json",
success: function (view) {
opts.callback(view);
},
error: function (xhr, ajaxOptions, thrownError) {
opts.callback("");
}
});
When I call the route through ajax using POST, the $info doesn't assigning to the quotation.flight.passengerDetails session.
But it does work when I do a request using reply XHR in Chrome Developer Tools?