mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Skip processing in CMS on empty ajax responses, as they're usually a pseudo redirect (via X-ControllerURL)
This commit is contained in:
parent
e01b0aa3d0
commit
aebbb10c9f
@ -83,11 +83,11 @@
|
||||
* (XMLHTTPRequest) xmlhttp
|
||||
*/
|
||||
loadForm_responseHandler: function(oldForm, html, status, xmlhttp) {
|
||||
if(!html) return;
|
||||
|
||||
if(oldForm.length > 0) {
|
||||
oldForm.replaceWith(html); // triggers onmatch() on form
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('.cms-content').append(html);
|
||||
}
|
||||
|
||||
@ -199,6 +199,8 @@
|
||||
*/
|
||||
submitForm_responseHandler: function(oldForm, data, status, xmlhttp, origData) {
|
||||
if(status == 'success') {
|
||||
if(!data) return;
|
||||
|
||||
var form, newContent = $(data);
|
||||
|
||||
// HACK If response contains toplevel panel rather than a form, replace it instead.
|
||||
|
@ -227,6 +227,10 @@ jQuery.noConflict();
|
||||
headers: headers,
|
||||
url: state.url,
|
||||
success: function(data, status, xhr) {
|
||||
// Pseudo-redirects via X-ControllerURL might return empty data, in which
|
||||
// case we'll ignore the response
|
||||
if(!data) return;
|
||||
|
||||
// Update title
|
||||
var title = xhr.getResponseHeader('X-Title');
|
||||
if(title) document.title = title;
|
||||
|
Loading…
Reference in New Issue
Block a user