Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.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
Jquery History.js+;形式?_Jquery_Ajax_History.js - Fatal编程技术网

Jquery History.js+;形式?

Jquery History.js+;形式?,jquery,ajax,history.js,Jquery,Ajax,History.js,我们正在从迁移到。Ajaxy拥有智能表单管理。有人知道如何将History.js集成到表单处理中吗?History.js本质上是一个跨浏览器的垫片,允许您使用HTML5历史API,它没有专门提供任何内置表单管理逻辑。因此,如果要使用它来管理表单状态,必须手动将历史记录条目添加到浏览器历史记录对象,如下所示: // If the History.js plugin has been included on the page if(window.History) { // Adds a n

我们正在从迁移到。Ajaxy拥有智能表单管理。有人知道如何将History.js集成到表单处理中吗?

History.js本质上是一个跨浏览器的垫片,允许您使用HTML5历史API,它没有专门提供任何内置表单管理逻辑。因此,如果要使用它来管理表单状态,必须手动将历史记录条目添加到浏览器历史记录对象,如下所示:

// If the History.js plugin has been included on the page
if(window.History) {

    // Adds a new state and url to the browser history object
    // Eg. If your page was index.html... it becomes index.html?someState
    window.History.pushState(null, $(this).attr("data-href"), "?someState");

}
// If the History.js plugin has been included on the page

    if(window.History) {

        // Binds to the StateChange Event
        window.History.Adapter.bind(window,'statechange',function() {

            // Do something

        });
    }
如果您有一些在发生状态更改时需要执行的自定义逻辑,您可以执行以下操作:

// If the History.js plugin has been included on the page
if(window.History) {

    // Adds a new state and url to the browser history object
    // Eg. If your page was index.html... it becomes index.html?someState
    window.History.pushState(null, $(this).attr("data-href"), "?someState");

}
// If the History.js plugin has been included on the page

    if(window.History) {

        // Binds to the StateChange Event
        window.History.Adapter.bind(window,'statechange',function() {

            // Do something

        });
    }

有关History.js的更多信息,请查看

您是否找到了有关如何使用表单以及如何使用History.js发布操作的信息?请回复。