不工作的页面刷新推状态主干航线 [英] Backbone route with push state not working on page refresh
本文介绍了不工作的页面刷新推状态主干航线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var Backbone = require('backbone'),
SellerProfileView = require('./views/seller/SellerProfileView');
var Router = Backbone.Router.extend({
routes: {
":user_name" : "sellerProfile"
},
sellerProfile: function (username) {
"use strict";
var sellerProfile = new SellerProfileView({username: username});
}
});
module.exports = Router
var Router = require('./router'),
Backbone = require('backbone'),
$ = require('jquery');
var app = {
init: function () {
"use strict";
Backbone.$ = $;
this.router = new Router();
$(document).ready(function () {
Backbone.history.start({ pushState: true, route: '/' });
});
}
};
module.exports = app;
app.init();
我得到下面的错误,如果我刷新页面没有#
I get the below error if i refresh the page without the hash
错误响应
错误code 404。
Error code 404.
消息:找不到文件
错误code解释:404 =什么的给定URI匹配
Error code explanation: 404 = Nothing matches the given URI.
请帮忙。
推荐答案
pushState的将尝试加载看来你的服务器是不是在'yourwebsiteurl.com/
pushState will try to load the ressource.And it seems your server is not loading anything at 'yourwebsiteurl.com/'
这篇关于不工作的页面刷新推状态主干航线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文