Skip to content

Commit 9baf0ac

Browse files
committed
Fix previousState scope to success closure
1 parent 5e563fb commit 9baf0ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jquery.pjax.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ function handleSubmit(event, container, options) {
159159
//
160160
// Returns whatever $.ajax returns.
161161
function pjax(options) {
162-
var previousState = pjax.state;
163-
164162
options = $.extend(true, {}, $.ajaxSettings, pjax.defaults, options)
165163

166164
if ($.isFunction(options.url)) {
@@ -235,6 +233,8 @@ function pjax(options) {
235233
}
236234

237235
options.success = function(data, status, xhr) {
236+
var previousState = pjax.state;
237+
238238
// If $.pjax.defaults.version is a function, invoke it first.
239239
// Otherwise it can be a static string.
240240
var currentVersion = (typeof $.pjax.defaults.version === 'function') ?

0 commit comments

Comments
 (0)