aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author藍挺瑋 <lantw44@gmail.com>2012-12-21 00:44:41 +0800
committerLAN-TW <lantw44@gmail.com>2012-12-21 00:44:41 +0800
commit621e3f7d260673fa4130c7b500464b451e90dbd3 (patch)
tree1be68b57714482796fc849efa4bf24289e62c85c
parent2a374c1f67ce35b52fc3fa412236681b34d4a57c (diff)
downloadinccalendar-621e3f7d260673fa4130c7b500464b451e90dbd3.tar.gz
inccalendar-621e3f7d260673fa4130c7b500464b451e90dbd3.tar.zst
inccalendar-621e3f7d260673fa4130c7b500464b451e90dbd3.zip
增加對老舊 IE 的 AJAX 支援,以及移除 fetch.py 回傳 XML 的整齊縮排格式
-rw-r--r--access/fetch.py3
-rw-r--r--js/data.js14
2 files changed, 14 insertions, 3 deletions
diff --git a/access/fetch.py b/access/fetch.py
index 2ab65ed..d36c25b 100644
--- a/access/fetch.py
+++ b/access/fetch.py
@@ -100,7 +100,6 @@ class FetchEvent(webapp2.RequestHandler):
self.response.headers['Content-Type'] = 'text/xml; charset=UTF-8'
self.response.out.write(
- etree.tostring(eventroot, pretty_print=True, xml_declaration=True,
- encoding='UTF-8'))
+ etree.tostring(eventroot, xml_declaration=True, encoding='UTF-8'))
app = webapp2.WSGIApplication([('/access/fetch', FetchEvent)])
diff --git a/js/data.js b/js/data.js
index 846f962..5cdf76b 100644
--- a/js/data.js
+++ b/js/data.js
@@ -44,7 +44,19 @@ function CalEvent(){
function create_xmlhttp_object(){
var rq;
- rq = new XMLHttpRequest();
+ try{
+ rq = new XMLHttpRequest();
+ }catch(err){
+ try{
+ rq = new ActiveXObject("Msxml2.XMLHTTP");
+ }catch(err){
+ try{
+ rq = new ActiveXObject("Microsoft.XMLHTTP");
+ }catch(err){
+ rq = null;
+ }
+ }
+ }
return rq;
}