summaryrefslogtreecommitdiffstats
path: root/modules/kajax/ajax.js
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-24 06:01:07 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-24 06:01:07 +0000
commit166452b0335dcf136cd2d296abf8473786df2af1 (patch)
treea7210c64e6f5533cbd603227894ca78cd236da2d /modules/kajax/ajax.js
parentd93527bece43eb4a3a564d892ba9ddc653ac11b0 (diff)
downloadampache-166452b0335dcf136cd2d296abf8473786df2af1.tar.gz
ampache-166452b0335dcf136cd2d296abf8473786df2af1.tar.bz2
ampache-166452b0335dcf136cd2d296abf8473786df2af1.zip
updated ajax so it works with IE
Diffstat (limited to 'modules/kajax/ajax.js')
-rwxr-xr-xmodules/kajax/ajax.js54
1 files changed, 28 insertions, 26 deletions
diff --git a/modules/kajax/ajax.js b/modules/kajax/ajax.js
index 84704400..73cb9064 100755
--- a/modules/kajax/ajax.js
+++ b/modules/kajax/ajax.js
@@ -3,47 +3,49 @@
// Origional Author: Kevin Riker
// Added Multi-Value XML based GET/POST replacement * Karl Vollmer
// Added Auto-Detects source/target information based on XML Doc Elements and
-// Form Elements if it's a post call * Karl Vollmer
+// Form Elements if it's a post call * Karl Vollmer
// Licensed under the GNU/GPL
-
+
var http_request = false;
var IE = true;
// uid is an array of uids that need to be replaced
function ajaxPut(url) {
+
if (window.ActiveXObject) { // IE
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- }
+ try {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- }
+ try {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
catch (e) {}
- }
- }
+ }
+ }
else { // Mozilla
IE = false;
http_request = new XMLHttpRequest();
}
- if (!http_request) {
- return false;
- }
- http_request.onreadystatechange = function() { getContents(http_request); };
- http_request.open('GET', url, true);
- http_request.send(null);
- }
+ if (!http_request) {
+ return false;
+ }
+ http_request.onreadystatechange = function() { getContents(http_request); };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+ }
- function getContents(http_request,uid) {
- if (http_request.readyState == 4) {
- data = http_request.responseXML;
- for(i=0;i<data.childNodes[0].childNodes.length;i++) {
- if (data.childNodes[0].childNodes[i].nodeType == '1') {
- var txt_node = data.childNodes[0].childNodes[i];
- var new_txt = txt_node.firstChild.nodeValue;
- document.getElementById(txt_node.localName).innerHTML = new_txt;
+ function getContents(http_request) {
+ if (http_request.readyState == 4) {
+ if (http_request.status == 200) {
+ var data = http_request.responseXML;
+ var newContent = http_request.responseXML.getElementsByTagName('content');
+
+ for(var i=0; i < newContent.length; i++) {
+ document.getElementById(newContent[i].getAttribute('div')).innerHTML=newContent[i].firstChild.nodeValue;
}
- }
+
+ }
}
}