MINOR Skip processing in CMS on empty ajax responses, as they're usually a pseudo redirect (via X-ControllerURL)

This commit is contained in:
Ingo Schommer 2012-04-05 22:13:56 +02:00
parent e01b0aa3d0
commit aebbb10c9f
2 changed files with 8 additions and 2 deletions

View File

@ -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.

View File

@ -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;