mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
some tweaks
This commit is contained in:
parent
35fd7ca908
commit
8c444e1bb9
4 changed files with 13 additions and 7 deletions
|
@ -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",
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
<?php
|
||||
$CONFIG = array (
|
||||
'installed' => true,
|
||||
'host' => 'localhost',
|
||||
'username' => 'shoppinglist',
|
||||
'passwd' => 'Erfolg100%',
|
||||
'database' => 'shoppinglist',
|
||||
'theme' => 'default',
|
||||
'installed' => false,
|
||||
);
|
||||
|
||||
?>
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue