Lars #135
@@ -5,12 +5,14 @@ session_start();
|
|||||||
require("../../queries/post.php");
|
require("../../queries/post.php");
|
||||||
require("../../queries/connect.php");
|
require("../../queries/connect.php");
|
||||||
require("../../queries/checkInput.php");
|
require("../../queries/checkInput.php");
|
||||||
|
|
||||||
if (empty($_POST['newcomment-content'])) {
|
if (empty($_POST['newcomment-content'])) {
|
||||||
|
echo 0;
|
||||||
} else {
|
} else {
|
||||||
makeComment($_POST['postID'],
|
if(makeComment($_POST['postID'],
|
||||||
$_SESSION['userID'],
|
$_SESSION['userID'],
|
||||||
test_input($_POST['newcomment-content']));
|
test_input($_POST['newcomment-content']))) {
|
||||||
}
|
echo 1;
|
||||||
|
} else {
|
||||||
header("Location: ../profile.php");
|
echo 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
18
website/public/js/post.js
Normal file
18
website/public/js/post.js
Normal 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
function loadPost(postID) {
|
|
||||||
$.get(
|
|
||||||
"API/loadPost.php",
|
|
||||||
$(postID).serialize()
|
|
||||||
).done(function (data) {
|
|
||||||
$('#modal-response').innerHTML= JSON.parse(data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
<script src="js/masonry.js"></script>
|
<script src="js/masonry.js"></script>
|
||||||
<!-- <script src="js/profile.js"></script>-->
|
<script src="js/post.js"></script>
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
@import url("styles/post-popup.css");
|
@import url("styles/post-popup.css");
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ echo("
|
|||||||
|
|
||||||
<div class='post-comments'>
|
<div class='post-comments'>
|
||||||
<div class="commentfield">
|
<div class="commentfield">
|
||||||
<form action="API/postComment.php" name="newcomment" method="post">
|
<form id="newcommentform" action="javascript:postComment();">
|
||||||
<input type="hidden" name="postID" value="<?= $postID ?>">
|
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||||
<textarea name="newcomment-content" Laat een reactie achter..."></textarea> <br>
|
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
|
||||||
<input type="submit" value="Reageer!">
|
<input type="submit" value="Reageer!">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user