web/static/res/js/incplayer.js
changeset 103 be6c1f9cc258
parent 93 7c37aaa2a8ae
child 124 8d2376eb825c
--- a/web/static/res/js/incplayer.js	Thu Jan 24 16:28:04 2013 +0100
+++ b/web/static/res/js/incplayer.js	Thu Jan 24 16:30:41 2013 +0100
@@ -138,6 +138,10 @@
 			for (var i = 0; i < videosIndex.length; ++i) {
 				this.sequences.push(this.allSequencesData.videos[videosIndex[i]]);		
 			}
+		} else if (wordsIndex[0] == null) {
+			// No reason to be here, redirection
+			location.href = "index.html";
+
 		} else {
 			// We choose new videos
 
@@ -764,14 +768,26 @@
 	this.loadJson = function(jsonFile)
 	{
 		var txt = this.loadTxtFile(jsonFile);
-		return JSON.parse(txt);
+		var obj = null;
+
+        $.ajax({
+            url: jsonFile,
+            async: false,
+            success: function (data){
+				obj = data;
+            }
+        });
+
+		return obj;
 	};
 
 	this.loadTxtFile = function(jsonFile)
 	{
 		var xhr = new XMLHttpRequest();
-		xhr.open("GET", jsonFile, false);  
-		xhr.overrideMimeType('text/plain; charset=x-user-defined');
+		xhr.open("GET", jsonFile, false); 
+		if (xhr.overrideMimeType) {
+			xhr.overrideMimeType('text/plain; charset=x-user-defined');
+		}
 
 		try {
 			xhr.send(null);