some tweaks

This commit is contained in:
Tim Krehan 2019-05-22 21:17:53 +02:00
parent 35fd7ca908
commit 8c444e1bb9
4 changed files with 13 additions and 7 deletions

View file

@ -1,4 +1,5 @@
$(document).ready(function () {
highlightNewEntry();
$("input[type=checkbox]").change(checkItem);
$("#remove").click(deleteCheckeditems);
$("#nameField").focus();
@ -6,6 +7,13 @@ $(document).ready(function () {
$("#nameField").on("focus", function () { $(this).select(); });
});
function highlightNewEntry(){
var cookies = document.cookie;
var cookieRegExp = new RegExp(/newItem(\d+)/ig);
console.log(cookies.match(cookieRegExp));
}
function deleteCheckeditems() {
$.post({
url: "api/list/del",

View file

@ -1,11 +1,6 @@
<?php
$CONFIG = array (
'installed' => true,
'host' => 'localhost',
'username' => 'shoppinglist',
'passwd' => 'Erfolg100%',
'database' => 'shoppinglist',
'theme' => 'default',
'installed' => false,
);
?>

View file

@ -41,7 +41,9 @@
$insertQuery = $mysqli->prepare("INSERT INTO `Einkauf` (`Anzahl`, `Einheit`, `Name`, `Erledigt`) VALUES (?, ?, ?, 0);");
$insertQuery->bind_param("sss", $anzahl, $einheit, $name);
$result = $insertQuery->execute();
$insertID = $mysqli->insert_id;
$mysqli->close();
return $insertID;
}
function newItems($itemList){

View file

@ -4,7 +4,8 @@
switch ($_GET["function"]) {
case 'new':
$shopping->newItem($_POST["anzahl"], $_POST["einheit"], $_POST["name"]);
$newID = $shopping->newItem($_POST["anzahl"], $_POST["einheit"], $_POST["name"]);
setcookie("newItem", "$newID", 0, "/", "");
header("Location: /list");
break;