My JavaScript sometimes crashes on this line:
var json = eval(\'(\' + this.responseText + \')\');
Crashes are caused when the argument of <
Why you can't just check what is the response? It is more more efficient.
var result; if (response.headers['Content-Type'] === 'application/json') result = JSON.parse(this.responseText); else result = this.responseText;
screen1