Skip to content

Commit 8c472eb

Browse files
author
Joseph Lenton
committed
saving changes now also works for ajax requests too
1 parent 197b7e4 commit 8c472eb

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/php_error.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,7 +2977,7 @@ private function displayJSInjection() {
29772977
*/
29782978
var retry = iDoc.getElementById('ajax-retry');
29792979
if ( retry ) {
2980-
retry.onclick = function() {
2980+
var retryFun = function() {
29812981
var methodCalls = self.__.methodCalls;
29822982

29832983
initializeXMLHttpRequest.call( self );
@@ -2990,6 +2990,9 @@ private function displayJSInjection() {
29902990

29912991
return false;
29922992
};
2993+
retry.onclick = retryFun;
2994+
2995+
iframe.__php_error_retry = retryFun;
29932996

29942997
/*
29952998
* The close handler.
@@ -3428,8 +3431,25 @@ function() use ( $saveUrl ) {
34283431
}
34293432
}
34303433

3434+
var retryFun = null;
3435+
if ( window.top !== window ) {
3436+
var arrFrames = parent.document.getElementsByTagName("IFRAME");
3437+
3438+
for (var i = 0; i < arrFrames.length; i++) {
3439+
if (arrFrames[i].contentWindow === window) {
3440+
retryFun = arrFrames[i].__php_error_retry;
3441+
}
3442+
}
3443+
}
3444+
3445+
if ( retryFun === null ) {
3446+
retryFun = function() {
3447+
document.location.reload( true );
3448+
}
3449+
}
3450+
34313451
if ( ! hasChanges ) {
3432-
document.location.reload(true);
3452+
retryFun();
34333453
} else {
34343454
$.ajax({
34353455
type: "POST",
@@ -3441,7 +3461,7 @@ function() use ( $saveUrl ) {
34413461
},
34423462

34433463
success: function(res, status, xhr) {
3444-
document.location.reload(true);
3464+
retryFun();
34453465
},
34463466

34473467
beforeSend: function(xhr) {

0 commit comments

Comments
 (0)