From 3b0d8380cbf03da5ecf8369a3cc73639ad6205fc Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 14 Sep 2015 18:41:49 +0100 Subject: [PATCH] fix json return things --- settings/settings.go | 4 +++- static/js/app.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/settings/settings.go b/settings/settings.go index 1727db99..2d4f70ed 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -48,7 +48,9 @@ func Execute(w http.ResponseWriter, r *http.Request) (int, error) { return 500, err } - commands.Execute() + w.Header().Set("Content-Type", "application/json") + w.Write([]byte("{}")) + go commands.Execute() } else { content, err := ioutil.ReadFile("config." + language) diff --git a/static/js/app.js b/static/js/app.js index 7375b563..489adc7a 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -8,9 +8,11 @@ $(document).ready(function() { url : url, data : data, dataType : 'json', - encode : true + encode : true, }).done(function(data) { - console.log(data); + alert("it workss"); + }).fail(function(data) { + alert("it failed"); }); event.preventDefault();