I'm running a backbone project on my localhost. I have set pushState: true
on my main router. On my index.html i have multiple views which contain images. Those views render a html-template in which the path to the image is defined:
<div>
<img src="images/image1.jpg">
</div>
Now, when clicking a specific link I have defined in my menu view:
secondpage: function(event) {
event.preventDefault();
var newRouter = new Backbone.Router();
var route = '/secondpage';
newRouter.navigate(route, {trigger: true});
},
After this, my URL gets changed into localhost/secondpage
, so far so good, but now, my view on the second page, which also contains an image (lets say image2) is not getting displayed and I get the error http://localhost/images/image2.jpg
not found...
how to solve this?
the path to your image should be something like /images/image2.jpg