Skip to content
Snippets Groups Projects
Commit 3563e675 authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Not working + modifications

parent 6c73f7ab
No related branches found
No related tags found
No related merge requests found
...@@ -49,8 +49,8 @@ export class Graph extends ManagedData { ...@@ -49,8 +49,8 @@ export class Graph extends ManagedData {
let payload = { let payload = {
action: "update_space", action: "update_space",
name: "space", graph: JSON.stringify(data),
payload: data, space: space_id,
}; };
jQuery.ajax({ jQuery.ajax({
...@@ -63,10 +63,12 @@ export class Graph extends ManagedData { ...@@ -63,10 +63,12 @@ export class Graph extends ManagedData {
// processData: false, // processData: false,
// dataType: "json", // dataType: "json",
success: function (data) { success: function (data) {
alert(data); console.log(data);
alert("Success");
}, },
error: function (errMsg) { error: function (errMsg) {
alert(errMsg); console.log(errMsg);
alert("Failure");
}, },
}); });
} }
......
...@@ -91,8 +91,9 @@ function update_space() { ...@@ -91,8 +91,9 @@ function update_space() {
if (current_user_can("edit_posts")) { if (current_user_can("edit_posts")) {
$plugin_dir = plugin_dir_path(__FILE__); $plugin_dir = plugin_dir_path(__FILE__);
// Use json encoding. // Use json encoding.
$filename = $plugin_dir . $_POST["name"] . ".json"; $payload = json_encode($_POST["payload"]);
$result = file_put_contents($filename, json_encode($_POST["payload"])); $filename = $plugin_dir . $payload["space"] . ".json";
$result = file_put_contents($filename, $payload["graph"]);
//echo print_r($_POST); //echo print_r($_POST);
echo "Saved file at "; echo "Saved file at ";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment