Laravel: javascript and ajax url is not converted properly -
when trying initialise javascript , css, getting problem in path. takes root url.
eg. have initialize
<script type="text/javascript" src="/bower_components/angular/angular.js"></script> it takes
<script type="text/javascript" src="http://localhost/bower_components/angular/angular.js"></script> the file must be
<script type="text/javascript" src="http://localhost/myapp/bower_components/angular/angular.js"></script> instead of
<script type="text/javascript" src="http://localhost/bower_components/angular/angular.js"></script> same problem ajax.
thanks, hasmukh
your problem not laravel you're doing html wrong.
if application doesn't sit down on root of site, using root-relative urls "/some/url/here" never work.
luckily, laravel can help out there - need utilize helpers including assets:
{{ html::style('css/site.css') }} {{ html::script('js/site.js') }} {{ html::image('images/logo.png') }} or if need utilize asset url in other form:
<a href="#" data-target="{{{ url::asset('files/test.pdf') }}}">download file</a> you may have set url application @ top of app/config/app.php though (especially if need absolute urls here, illustration in html emails).
laravel laravel-4
No comments:
Post a Comment