summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorHannes "Brolaugh" Kindströmmer <me@brolaugh.com>2016-03-17 18:49:59 +0100
committerHannes "Brolaugh" Kindströmmer <me@brolaugh.com>2016-03-17 18:49:59 +0100
commit9a277b2d4d6e66a271be1acb18509affb7649248 (patch)
tree3e8ff639774a8cc9955391e2b78aac460dac008e /js
parentca8212a1182d6f332347d43b86948be2897f0964 (diff)
downloadtasklist-php-9a277b2d4d6e66a271be1acb18509affb7649248.zip
tasklist-php-9a277b2d4d6e66a271be1acb18509affb7649248.tar.gz
tasklist-php-9a277b2d4d6e66a271be1acb18509affb7649248.tar.bz2
Taks are now added to the feed with javascript
Diffstat (limited to 'js')
-rw-r--r--js/master.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/js/master.js b/js/master.js
index b177bdd..eafa05c 100644
--- a/js/master.js
+++ b/js/master.js
@@ -14,18 +14,31 @@ function addTask(){
var tasktitle = document.getElementById("tasktitle").value;
var taskbody = document.getElementById("taskbody").value;
var taskperson = document.getElementById("taskperson").value;
- console.log("Häre är jag!");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("tasktitle").value = "";
document.getElementById("taskbody").value = "";
document.getElementById("taskperson").value = "";
+ getLastTask();
}
};
xmlhttp.open("POST", "App/formhandler/add_listitem.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("tasktitle="+tasktitle+"&taskbody="+taskperson+"&taskperson"+taskperson);
}
+function getLastTask(){
+ var xmlhttp = new XMLHttpRequest();
+ console.log("Häre är jag!");
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ console.log("Häre är jag!");
+ $("#feed").append(xmlhttp.responseText);
+ }
+ };
+ xmlhttp.open("POST", "App/ajax/lasttask.php", true);
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.send();
+}
function changeStatus(){
var xmlhttp = new XMLHttpRequest();
var user = document.getElementById("modalname").value;