Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript sammyjs无法返回到我以前访问过的路线_Javascript_Asp.net_Asp.net Mvc_Routing_Sammy.js - Fatal编程技术网

Javascript sammyjs无法返回到我以前访问过的路线

Javascript sammyjs无法返回到我以前访问过的路线,javascript,asp.net,asp.net-mvc,routing,sammy.js,Javascript,Asp.net,Asp.net Mvc,Routing,Sammy.js,我是SammyJS的新手,我遇到了一个问题。我有我的路线工作,但是当我访问1,然后我去另一个。它起作用了。问题是当我试图回到我访问的第一条路线时。我正在使用ASP.NETMVC和sammyjs 这是我的密码 <script type="text/javascript" charset="utf-8"> debugger; ; (function ($) { var app = $.sammy(function () { debugger; th

我是SammyJS的新手,我遇到了一个问题。我有我的路线工作,但是当我访问1,然后我去另一个。它起作用了。问题是当我试图回到我访问的第一条路线时。我正在使用ASP.NETMVC和sammyjs

这是我的密码

<script type="text/javascript" charset="utf-8">
debugger;
; (function ($) {
    var app = $.sammy(function () {
        debugger;
        this.get('#/PartIndex', function () {
            var routing = new Routing('@Url.Content("~/")', '#testing', 'CustomerDetail/CustomerEditDetailPartial');
            routing.init();
        });
        this.get('#/ECheckbook', function () {
            debugger;
            var routing = new Routing('@Url.Content("~/")', '#testing', 'CustomerDetail/CustomerEditDetailPartial');
            routing.init();
        });
    });
    $(function () {
        app.run()
    });
})(jQuery);
}

<div class="page-container">
        <a href="#/ECheckbook">Margin</a>
<br />
<a href="#/PartIndex">Main</a>
    <div id="testing">

    </div>
function getUrlFromHash(hash) {
    debugger;
    var secondString = hash.split('/')[2];
    var url = hash.replace('#/', '').replace(secondString + '/', '');
    if (url === appRoot)
        url = defaultRoute;
    return url;
}

return {
    init: function () {
        Sammy(contentSelector, function () {
            this.get(/\#\/(.*)/, function (context) {
                var url = getUrlFromHash(context.path);
                context.load(url).swap();
            });
        }).run('#/');
    }
};