i just can't seem to find the problem, hope someone can help me.
Im trying to reach my controller, and then use my parameter, but it alwasy says its missing the parameter.
Route file:
Route::get('admin/site-settings/global-data/{part?}/', ['as' => 'admin/global-data-edit', 'uses' => 'admin\GlobalDatasController@getGlobalData']);
Function:
public function getGlobalData(Request $request, $part){
$globalData = GlobalData::find(1);
switch ($part){
case "content":
if($request->ajax()){
return view('admin.site-settings.global-data._ajax_load_content', compact('globalData'));
}
return view('admin.site-settings.global-data.edit')->with('globalData', $globalData);
break;
case "logo":
if($request->ajax()){
return view('admin.site-settings.global-data._ajax_load_logo', compact('globalData'));
}
return view('admin.site-settings.global-data.edit')->with('globalData', $globalData);
break;
}
}
AND my View:
function load_data() {
$('#load-data').hide().html('<div class="loader"><i class="fa fa-spinner" aria-hidden="true"></i></div>').fadeIn();
var url = '{{route('admin/global-data-edit')}}';
$.ajax({
url: url,
type: "GET",
success: function(data){
$data = $(data);
$('#load-data').hide().html($data).fadeIn();
}
});
}
Thank you so muych for your time in advance!
Best regards.