added export for list entries

This commit is contained in:
Tim Krehan 2018-10-29 22:23:51 +01:00
parent 406c5d9e0a
commit 84729d5912
3 changed files with 11 additions and 2 deletions

View file

@ -12,7 +12,12 @@ $(document).ready(function(){
$("#mail-input").focus(function(){$(this).css("color", "black");});
$("#export-recipe-button").click(function(){
$.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");
});
});
});

View file

@ -19,6 +19,11 @@
case 'check':
$shopping->check($_POST["id"], $_POST["status"]);
break;
case 'export':
echo json_encode($shopping);
break;
default:
// code...

View file

@ -29,7 +29,6 @@
case 'export':
$book->fillCookbook();
header("Content-type: text/json");
echo json_encode($book);
break;