From 1108054e52ba9429ccaf5693361c8f7c2e3993de Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Thu, 19 Oct 2017 10:42:30 +0200 Subject: [PATCH] fix: application/json content type from PHP handled correctly in JS --- unx.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unx.js b/unx.js index 21eb9af1..ff1caa8a 100644 --- a/unx.js +++ b/unx.js @@ -216,7 +216,9 @@ function fd(url,gd,hd,id){ if(jd.readyState==4){ if(jd.status==200){ var kd=jd.getResponseHeader('Content-Type'); - kd=kd.substr(0,kd.indexOf(';')); + if (kd.indexOf(';') > -1) { + kd=kd.substr(0,kd.indexOf(';')); + } switch(kd){ case'application/json': if (jd.responseText.indexOf('[]') < 0) {