added live sending messages from user 2 to user 2

This commit is contained in:
Lars van Hijfte
2017-01-18 12:08:53 +01:00
parent 51378bf386
commit eb2a343d5f
5 changed files with 90 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
<style>
@import url("styles/chat.css");
</style>
<script src="js/sendMessage.js"></script>
</head>
<body>
<?php

View File

@@ -0,0 +1,14 @@
// $("#sendMessageForm").submit(function(e) {
function sendMessage() {
console.log($("#sendMessageForm").serialize());
$.post(
"sendMessage.php",
$("#sendMessageForm").serialize()
).done(function( data ) {
alert( "Data Loaded: " + data );
});
}
function loadMessages() {
}

View File

@@ -0,0 +1,16 @@
<?php
include_once("../queries/private_message.php");
if (isset($_POST["destination"]) &&
isset($_POST["content"])) {
if (sendMessage($db, $_POST["destination"], $_POST["content"])) {
echo $_POST["content"] . " is naar " . $_POST["destination"] . " gestuurd";
} else {
echo "YOU FAILED!!!";
}
} else {
echo "maybe dont try to hax the system?";
}