- var json = eval("(" + this.request.responseText + ")");
- this.callback(json, "json");
+
+ var json = null;
+ var text = this.request.responseText;
+ if (typeof window.JSON == "undefined")
+ json = eval("(" + text + ")");
+ else {
+ try {
+ json = JSON.parse(text);
+ }
+ catch (e) {
+ // Safari: eval will fail as well. Considering trying JSON2 (non-native implementation) instead
+ /* DEBUG only works in mk2-mobile
+ if (document.getElementById("log"))
+ document.getElementById("log").innerHTML = "" + e + " " + length + ": " + text;
+ */
+ try {
+ json = eval("(" + text + ")");
+ }
+ catch (e) {
+ /* DEBUG only works in mk2-mobile
+ if (document.getElementById("log"))
+ document.getElementById("log").innerHTML = "" + e + " " + length + ": " + text;
+ */
+ }
+ }
+ }
+ this.callback(json, "json");