diff options
author | pixel <pixel> | 2008-01-21 04:03:43 +0000 |
---|---|---|
committer | pixel <pixel> | 2008-01-21 04:03:43 +0000 |
commit | f09725449e47dbf9503eb0d6ceb64cda2bdb297b (patch) | |
tree | de3ed7aebf53e1b528dc7db9912f65f7ce32ad05 /lib | |
parent | 0ea2b16f3199e1dc9f746f688d7530e6e3d94570 (diff) |
Adding more solid support for IE
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ajaxlib.lua | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/ajaxlib.lua b/lib/ajaxlib.lua index 398d3b1..9a37daf 100644 --- a/lib/ajaxlib.lua +++ b/lib/ajaxlib.lua @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: ajaxlib.lua,v 1.2 2008-01-15 18:20:23 pixel Exp $ */ +/* $Id: ajaxlib.lua,v 1.3 2008-01-21 04:03:43 pixel Exp $ */ ]]-- @@ -57,6 +57,7 @@ end ajaxlib_javascript = [[ var loading = 0; +var isIE = false; function ajax_loading(v) { @@ -87,17 +88,40 @@ function ajax_hub(ajax_request, callback) ajax_loading(loading != 0); } +function new_XMLHttpRequest() +{ + var r; + + if (window.XMLHttpRequest) { + r = new XMLHttpRequest(); + // branch for IE/Windows ActiveX version + } else if (window.ActiveXObject) { + r = new ActiveXObject("Microsoft.XMLHTTP"); + isIE = true; + } + + return r; +} + function ajax_create(url, callback) { var ajax_request; + ajax_request = new_XMLHttpRequest(); + + if (!ajax_request) + return; + loading++; ajax_loading(true); - ajax_request = new XMLHttpRequest(); ajax_request.onreadystatechange = function() { ajax_hub(ajax_request, callback) }; ajax_request.open("GET", url, true); - ajax_request.send(null); + if (isIE) { + ajax_request.send(); + } else { + ajax_request.send(null); + } } function ajax_do_get_data(res) |