callback_called = false;
$form[0].reset();
+ $form.find('.alert-danger').remove();
$form.find('#id_host').val(parts.shift());
if (parts.length)
e.preventDefault();
$btn.button('loading');
+ $this.find('.alert-danger').remove();
$.post($this.attr('action'), $this.serialize(), function(data) {
callback(data);
console.error(arguments);
var error = (xhr.responseJSON || {}).error || undefined;
+ if (error.__all__) {
+ error = 'Podana lokalizacja jest już zapisana'
+ }
+ else if (xhr.status == 400) {
+ error = 'Niepoprawna nazwa hosta lub ścieżka'
+ }
+
if (typeof error === 'string') {
$('<div>', {
'class': 'alert alert-danger',