Lars #135

Merged
11291680 merged 14 commits from lars into master 2017-01-26 14:14:41 +01:00
5 changed files with 30 additions and 18 deletions
Showing only changes of commit 91aca6baa7 - Show all commits

View File

@@ -5,12 +5,14 @@ session_start();
require("../../queries/post.php");
require("../../queries/connect.php");
require("../../queries/checkInput.php");
if (empty($_POST['newcomment-content'])) {
echo 0;
} else {
makeComment($_POST['postID'],
if(makeComment($_POST['postID'],
$_SESSION['userID'],
test_input($_POST['newcomment-content']));
}
header("Location: ../profile.php");
test_input($_POST['newcomment-content']))) {
echo 1;
} else {
echo 0;
}
}

18
website/public/js/post.js Normal file
View File

@@ -0,0 +1,18 @@
function postComment() {
$.post(
"API/postComment.php",
$("#newcommentform").serialize()
);
$("#newcomment").val("");
//reload post
$.get(
"API/loadPost.php",
$("#newcommentform").serialize()
).done(function (data) {
$('#modal-response').html(data);
});
}

View File

@@ -1,8 +0,0 @@
function loadPost(postID) {
$.get(
"API/loadPost.php",
$(postID).serialize()
).done(function (data) {
$('#modal-response').innerHTML= JSON.parse(data);
});
}

View File

@@ -3,7 +3,7 @@
<head>
<?php include("../views/head.php"); ?>
<script src="js/masonry.js"></script>
<!-- <script src="js/profile.js"></script>-->
<script src="js/post.js"></script>
<style>
@import url("styles/profile.css");
@import url("styles/post-popup.css");

View File

@@ -21,9 +21,9 @@ echo("
<div class='post-comments'>
<div class="commentfield">
<form action="API/postComment.php" name="newcomment" method="post">
<input type="hidden" name="postID" value="<?= $postID ?>">
<textarea name="newcomment-content" Laat een reactie achter..."></textarea> <br>
<form id="newcommentform" action="javascript:postComment();">
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
<input type="submit" value="Reageer!">
</form>
</div>