added live sending messages from user 2 to user 2
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<style>
|
||||
@import url("styles/chat.css");
|
||||
</style>
|
||||
<script src="js/sendMessage.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
14
website/public/js/sendMessage.js
Normal file
14
website/public/js/sendMessage.js
Normal 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() {
|
||||
|
||||
}
|
||||
16
website/public/sendMessage.php
Normal file
16
website/public/sendMessage.php
Normal 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?";
|
||||
}
|
||||
Reference in New Issue
Block a user