summaryrefslogtreecommitdiff
path: root/tw-sack.js
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-06-04 23:53:55 +0200
committerandi <andi@splitbrain.org>2005-06-04 23:53:55 +0200
commit56c1874e2aaf8d8e59d21b4d305eb63a392ab7fa (patch)
tree982ef4262fba033958eee175751c9aebd3afea48 /tw-sack.js
parent8cbcbff7d52f21e65c1a52b07ff5767f70e49f54 (diff)
downloadrpg-56c1874e2aaf8d8e59d21b4d305eb63a392ab7fa.tar.gz
rpg-56c1874e2aaf8d8e59d21b4d305eb63a392ab7fa.tar.bz2
much better Opera 8 AJAX fix (no fallback to GET needed)
darcs-hash:20050604215355-9977f-e4c9fd58263ae3f237b322b1d7da27a13a68e383.gz
Diffstat (limited to 'tw-sack.js')
-rw-r--r--tw-sack.js22
1 files changed, 5 insertions, 17 deletions
diff --git a/tw-sack.js b/tw-sack.js
index 6fcd5a2c4..8a9d12746 100644
--- a/tw-sack.js
+++ b/tw-sack.js
@@ -59,24 +59,12 @@ function sack(file){
if (this.element) { this.elementObj = document.getElementById(this.element); }
if (this.xmlhttp) {
var self = this; // wierd fix for odd behavior where "this" wouldn't work in the readystate function.
- // Opera doesn't support setRequestHeader, try catch is for IE
- try {
- if(!this.xmlhttp.setRequestHeader){
- this.method = "GET";
- }
- } catch (ex) { }
-
- if (this.encodeURIString){ this.URLString = this.encodeURLString(this.URLString); }
-
- if (this.method == "POST") {
- this.xmlhttp.open(this.method, this.requestFile ,true);
- this.xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- this.xmlhttp.send(this.URLString);
- }else{
- this.xmlhttp.open(this.method, this.requestFile+'?'+this.URLString, true);
- this.xmlhttp.send();
+ this.xmlhttp.open(this.method, this.requestFile ,true);
+ if (this.method == "POST" && this.xmlhttp.setRequestHeader) {
+ this.xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
}
-
+ if (this.encodeURIString){ this.URLString = this.encodeURLString(this.URLString); }
+ this.xmlhttp.send(this.URLString);
this.xmlhttp.onreadystatechange = function() {
switch (self.xmlhttp.readyState){
case 1: // Loading.