Commit 0f81bdce by Julian Arni

Properly handle error responses

parent cdf0eef5
...@@ -77,16 +77,11 @@ $('#fileupload').fileupload({ ...@@ -77,16 +77,11 @@ $('#fileupload').fileupload({
e.preventDefault(); e.preventDefault();
submitBtn.hide(); submitBtn.hide();
data.submit().complete(function(result, textStatus, xhr) { data.submit().complete(function(result, textStatus, xhr) {
if (result.status != 200 && result.status != 302) { if (xhr.status != 200) {
alert('${_("Your import has failed.")}\n\n' + JSON.parse(result.responseText)["ErrMsg"]); alert('${_("Your import has failed.")}\n\n' + result["ErrMsg"]);
submitBtn.show(); submitBtn.show();
bar.hide(); bar.hide();
} else { }
if (result.responseText["ImportStatus"] == 1) {
bar.hide();
statusBlock.show();
}
}
}); });
}); });
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment