Added support do do a push-state ajax request with forms

This commit is contained in:
markusfluer
2017-09-18 14:13:39 +02:00
parent 109e78347f
commit 86e5a2281a
10 changed files with 214 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ var Pjax = function(options) {
opt.url = st.state.url
opt.title = st.state.title
opt.history = false
opt.requestOptions = {};
if (st.state.uid < this.lastUid) {
opt.backward = true
}
@@ -55,6 +55,8 @@ Pjax.prototype = {
attachLink: require("./lib/proto/attach-link.js"),
attachForm: require("./lib/proto/attach-form.js"),
forEachSelectors: function(cb, context, DOMcontext) {
return require("./lib/foreach-selectors.js").bind(this)(this.options.selectors, cb, context, DOMcontext)
},
@@ -151,7 +153,7 @@ Pjax.prototype = {
trigger(document, "pjax:send", options);
// Do the request
this.doRequest(href, function(html) {
this.doRequest(href, options.requestOptions, function(html) {
// Fail if unable to load HTML via AJAX
if (html === false) {
trigger(document,"pjax:complete pjax:error", options)