在我的Laravel项目中,我设置了一条路线来显示用户的个人资料页面。
Route::get('{id}', ['as' => 'profile', 'uses' => 'UsersController@show']);
这条路线一切都很好。但是,我想将路线更改为
Route::get('profile/{id}', ['as' => 'profile', 'uses' => 'UsersController@show']);
当我这样做并导航到my.app:8000/profile/1
我的CSS和html很好时,但是我得到了一个损坏的图像链接,而我的jquery不再起作用
我也试过了
Route::get('/profile/{id}', ['as' => 'profile', 'uses' => 'UsersController@show']);
我src="{{URL::asset("images/users/xxxxxxx")}}"
用来加载我的图像以及jquery
在我的路线文件中的其他地方没有我的路线 profile/
不知道我能做什么。有人知道解决此问题的方法吗?
编辑:
这是我的html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!--Main Style Sheet-->
{{ HTML::style('css/style.css'); }}
<!-- JQuery -->
<script src="/jquery/jquery-1.11.0.js"></script>
</head>
<body class="main-body">
<!-- this image works now that i added the leading / -->
<img src="{{ URL::asset("/images/users/{$user->id}/profilePictures/176thumb-{$user->profilePicture->url}") }}" alt="{{ $user->first_name }} {{ $user->last_name }} Profile Picture" width="176" height="176">
<!-- the jQuery For this is not working -->
<ul class="list-grid">
<li>
<div class="profile-example">
<div class="add-box"></div>
</div>
</li>
</ul>
<!-- Include woodmark. This is the jquery plugin that isn't working -->
<script src="/jquery/jquery.wookmark.js"></script>
<!--Woodmark settings-->
<script type="text/javascript">
(function ($){
$(function() {
var $handler = $('.list-grid li');
$handler.wookmark({
// Prepare layout options.
align: 'center',
autoResize: true,
comparator: null,
container: $('html'),
direction: undefined,
ignoreInactiveItems: true,
itemWidth: 560,
fillEmptySpace: false,
flexibleWidth: true,
offset: 8,
onLayoutChanged: undefined,
outerOffset: 0,
possibleFilters: [],
resizeDelay: 50,
verticalOffset: undefined
});
});
})(jQuery);
</script>
</body>
</html>
我用了
{{ HTML::script('jquery/jquery.js'); }}
代替
<script src="/jquery/jquery.js"></script>
现在一切正常
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句