Many UTF-8 fixes:
[platal.git] / htdocs / javascript / ajax.js
index 8db2aef..e274892 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -35,7 +35,7 @@ Ajax = {
                 }
             }
             if (Ajax.xml_client == null) {
-                alert("Ton client ne supporte pas Ajax, nécessaire pour certaines fonctionalités de cette page");
+                alert("Ton client ne supporte pas Ajax, nécessaire pour certaines fonctionalités de cette page");
             }
         }
         Ajax.init = true;
@@ -47,12 +47,16 @@ Ajax = {
         if (Ajax.xml_client == null) {
             return true;
         }
-        Ajax.xml_client.onreadystatechange =
-            function()
+        Ajax.xml_client.abort();
+        Ajax.xml_client.onreadystatechange = function()
             {
                 if(Ajax.xml_client.readyState == 4) {
                     if (Ajax.xml_client.status == 200) {
-                        document.getElementById(obj).innerHTML = Ajax.xml_client.responseText;
+                       if (obj != null) {
+                               document.getElementById(obj).innerHTML = Ajax.xml_client.responseText;
+                        }
+                    } else if (Ajax.xml_client.status == 403) {
+                        window.location.reload();
                     }
                 }
             };
@@ -62,3 +66,4 @@ Ajax = {
     }
 }
 
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: