added alert box when emptpy posting

This commit is contained in:
Hendrik
2017-02-02 13:42:59 +01:00
parent 12d5e00731
commit d4d16661df
5 changed files with 56 additions and 31 deletions

View File

@@ -31,14 +31,28 @@ function postPost() {
$.post("API/postPost.php", { title: title,
content : content,
group : groupID })
.done(function() {
masonry(masonryMode);
.done(function(data) {
if (data == "empty") {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else {
$('#alertbox').hide();
masonry(masonryMode);
}
});
} else {
$.post("API/postPost.php", { title: title,
content : content })
.done(function() {
masonry(masonryMode);
.done(function(data) {
if (data == "empty") {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else {
$('#alertbox').hide();
masonry(masonryMode);
}
});
}
@@ -153,9 +167,6 @@ function loadMorePosts(uID, gID, offset, limit) {
return;
}
console.log(uID, gID, offset, limit);
$.post("API/getPosts.php", { usr : uID,
grp : gID,
offset : offset,