Правка приёма JSON
This commit is contained in:
@ -1,18 +1,23 @@
|
||||
/*jshint esversion: 6 */
|
||||
"use strict";
|
||||
|
||||
//var g_translations = {'':''};
|
||||
|
||||
//Массив g_translations подгружается отдельно
|
||||
function trt(key)
|
||||
{
|
||||
if(key==null || key===undefined) return '';
|
||||
let val=g_translations[key];
|
||||
if(val==null || val===undefined)
|
||||
{
|
||||
for(let item in g_translations) {
|
||||
if(item.toLowerCase()==(''+key).toLowerCase())
|
||||
{
|
||||
val=g_translations[item];
|
||||
break;
|
||||
let val=null;
|
||||
if(g_translations !== undefined){
|
||||
val=g_translations[key];
|
||||
if(val==null || val===undefined)
|
||||
{
|
||||
for(let item in g_translations) {
|
||||
if(item.toLowerCase()==(''+key).toLowerCase())
|
||||
{
|
||||
val=g_translations[item];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1163,6 +1168,7 @@ class TRequest
|
||||
{
|
||||
if(typeof(xmlHttpRequest.status)=='undefined' || xmlHttpRequest.status == 200)
|
||||
{
|
||||
//console.log()
|
||||
if(xmlHttpRequest.responseXML!=null) {
|
||||
//if(typeof(xmlHttpRequest.responseXML)=='undefined' && xmlHttpRequest.contentType.match(/\/xml/)) //For IE XDomainRequest
|
||||
// xmlHttpRequest.responseXML=CreateXMLDOC(xmlHttpRequest.responseText);
|
||||
@ -1182,9 +1188,10 @@ class TRequest
|
||||
}
|
||||
}
|
||||
}else{
|
||||
let obj = JSON.parse(xmlHttpRequest.responseText);
|
||||
let obj=null;
|
||||
try { obj = JSON.parse(xmlHttpRequest.responseText); } catch (e) {}
|
||||
if(obj==null) {
|
||||
alert2(trt('Alert'), trt('Wrong_JSON_document') + "!\nJSON=(" + xmlHttpRequest.responseText + ')');
|
||||
alert2(trt('Alert'), trt('Wrong_JSON_document') + "!\nJSON=(" + xmlHttpRequest.responseText + ') ',xmlHttpRequest.responseURL);
|
||||
return;
|
||||
}
|
||||
if(this.winObj!=null)
|
||||
|
||||
Reference in New Issue
Block a user