From b60d56327a1b8531d15348034889e67f8b49444d Mon Sep 17 00:00:00 2001 From: piernov Date: Mon, 2 May 2016 15:44:28 +0200 Subject: Allow empty data from server --- js/craftmine.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/craftmine.js b/js/craftmine.js index 8af8296..608efb7 100644 --- a/js/craftmine.js +++ b/js/craftmine.js @@ -11,7 +11,8 @@ function sendRequest(url, params, callback) { xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == "200") { - var data = JSON.parse(xhr.responseText); + var data = ""; + if(xhr.responseText) data = JSON.parse(xhr.responseText); if(data.info) showInfo(data.info); if(data.error) { -- cgit v1.2.3-54-g00ecf