Skip to content

Commit 33348a2

Browse files
committed
add error handlers to ajax calls
1 parent 55a7eb5 commit 33348a2

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

webroot/admin/content.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@
6161
dataType: "json",
6262
success: function(result) {
6363
mainEditor.setData(result.content);
64-
}});
64+
},
65+
error: function() {
66+
mainEditor.setData("Something went wrong...");
67+
},
68+
});
6569
});
6670

6771
$("#pageForm").on("submit", function(e) {

webroot/js/modal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ function openModal(title, link) {
55
success: function (result) {
66
$("div.modalBody").html(result);
77
},
8+
error: function () {
9+
$("div.modalBody").html("Something went wrong...");
10+
},
811
});
912

1013
$("div.modalWrapper").fadeIn(100); // With Animation

webroot/js/tables.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ $("button.btnExpand").click(function () {
3333
$.ajax({
3434
url: ajax_url + gid,
3535
success: function (result) {
36-
console.log(result);
3736
piRow.after(result);
3837
},
38+
error: function () {
39+
piRow.after("Something went wrong...");
40+
},
3941
});
4042

4143
$(this).addClass("btnExpanded");

webroot/panel/modal/new_key.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ function generateKey(type) {
7676
$("input[type=hidden][name=gen_key]").val(result.public);
7777
downloadFile(result.private, "privkey." + type); // Force download of private key
7878
$("#newKeyform").submit();
79+
},
80+
error: function() {
81+
console.log("Something went wrong...");
7982
}
8083
});
8184
}

webroot/panel/modal/new_pi.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
} else {
4040
searchWrapper.show();
4141
}
42+
},
43+
error: function() {
44+
searchWrapper.html("Something went wrong...");
45+
searchWrapper.show();
4246
}
4347
});
4448
});

0 commit comments

Comments
 (0)