I need to load a template through jQuery.load()
which I'm doing like this in routes/web.php
:
Route::get('/steamfriends/{q}', function($q) {
return View::make('steamfriends_list')->with("SteamFriends", Steam::user($q)->GetFriendList());
});
Then with jQuery in the main template:
<script type="text/javascript">
$(document).ready(function() {
$('.uiFL').load('/steamfriends/{{ $user->steamId }}', callback);
function callback()
{
$(".loading").hide();
}
});
</script>
Then in the steamfriends
template (this is all content in it):
@forelse($SteamFriends as $friends)
<div class="box">
<ul>
<li>
<div class="item_start" style="width:100%">
@if(app\Http\Controllers\MyController::MyFunction($friends->steamId)) Hello World @endif
</div>
</li>
</ul>
</div>
@empty
<i>No data available.</i>
@endforelse
But the problem here is that I can't access MyController
, it gives me an error that the class is not found. How would I, in the easiest way, access the function that MyController
holds?