From 7749b8ed569f6d27b0bb2ed4c2040e8b61ed4422 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 9 Mar 2014 23:21:23 -0400 Subject: Automatic actions --- assets/js/board.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'assets') diff --git a/assets/js/board.js b/assets/js/board.js index 33e47053..501c39c3 100644 --- a/assets/js/board.js +++ b/assets/js/board.js @@ -140,6 +140,23 @@ var xhr = new XMLHttpRequest(); xhr.open("POST", "?controller=board&action=save&project_id=" + projectId, true); + + xhr.onreadystatechange = function(response) { + + if (this.readyState == this.DONE) { + try { + var response = JSON.parse(this.responseText); + + if (response.result == true) { + + // TODO: don't refresh the whole page! + window.location = "?controller=board&action=show&project_id=" + projectId; + } + } + catch (e) {} + } + }; + xhr.send(JSON.stringify(data)); } -- cgit v1.2.3