mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
added export for list entries
This commit is contained in:
parent
406c5d9e0a
commit
84729d5912
3 changed files with 11 additions and 2 deletions
|
@ -12,7 +12,12 @@ $(document).ready(function(){
|
||||||
$("#mail-input").focus(function(){$(this).css("color", "black");});
|
$("#mail-input").focus(function(){$(this).css("color", "black");});
|
||||||
$("#export-recipe-button").click(function(){
|
$("#export-recipe-button").click(function(){
|
||||||
$.post("/php/edit-recipes.php", {function:"export"}, function(data){
|
$.post("/php/edit-recipes.php", {function:"export"}, function(data){
|
||||||
downloadObjectAsJson(data, "recipes");
|
downloadObjectAsJson(JSON.parse(data), "recipes");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#export-list-button").click(function(){
|
||||||
|
$.post("/php/edit-list.php", {function:"export"}, function(data){
|
||||||
|
downloadObjectAsJson(JSON.parse(data), "list");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
|
|
||||||
case 'check':
|
case 'check':
|
||||||
$shopping->check($_POST["id"], $_POST["status"]);
|
$shopping->check($_POST["id"], $_POST["status"]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'export':
|
||||||
|
echo json_encode($shopping);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// code...
|
// code...
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
case 'export':
|
case 'export':
|
||||||
$book->fillCookbook();
|
$book->fillCookbook();
|
||||||
header("Content-type: text/json");
|
|
||||||
echo json_encode($book);
|
echo json_encode($book);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue