summaryrefslogtreecommitdiffstats
path: root/modules/kajax/ajax.js
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-12 23:42:09 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-12 23:42:09 +0000
commit5d8360f53dd665f1da37c8860dda497b03dc9124 (patch)
tree4f0be45d010030622d02e6c737b04dbb33e428e4 /modules/kajax/ajax.js
parent8257b8bd4ba57f8c433a5642de5d2d35e45de280 (diff)
downloadampache-5d8360f53dd665f1da37c8860dda497b03dc9124.tar.gz
ampache-5d8360f53dd665f1da37c8860dda497b03dc9124.tar.bz2
ampache-5d8360f53dd665f1da37c8860dda497b03dc9124.zip
many hours for so little code
Diffstat (limited to 'modules/kajax/ajax.js')
-rwxr-xr-xmodules/kajax/ajax.js41
1 files changed, 36 insertions, 5 deletions
diff --git a/modules/kajax/ajax.js b/modules/kajax/ajax.js
index 439cda3c..ea008ba3 100755
--- a/modules/kajax/ajax.js
+++ b/modules/kajax/ajax.js
@@ -1,10 +1,9 @@
// Copyright Ampache.org 2001 - 2006
// All Rights Reserved
-// Origional Author Kevin Riker
-// Updated to handle post and XML Get by Karl Vollmer
-// Published under the GNU GPL
-
- //var xmlDoc = null;
+// Origional Author: Kevin Riker
+// Added Multi-Value XML based GET/POST replacement * Karl Vollmer
+// Licensed under the GNU/GPL
+
var http_request = false;
var IE = true;
@@ -66,3 +65,35 @@
}
}
}
+
+ function ajaxPost(url,input,output) {
+
+ var post_data = 'a=0';
+
+ for(i=0;i<input.length;i++) {
+ post_data = post_data +'&' + input[i] + '=' + encodeURI(document.getElementById(input[i]).value);
+ }
+ var http_request = false;
+ if (window.XMLHttpRequest) { // Mozilla, Safari,...
+ http_request = new XMLHttpRequest();
+ } else if (window.ActiveXObject) { // IE
+ try {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ try {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e) {}
+ }
+ }
+ if (!http_request) {
+ return false;
+ }
+ http_request.onreadystatechange = function() { getContents(http_request,output); };
+ http_request.open('POST', url, true);
+ http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ http_request.setRequestHeader("Content-length", post_data.length);
+ http_request.setRequestHeader("Connection", "close");
+ http_request.send(post_data);
+
+
+ }