1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

many hours for so little code

This commit is contained in:
Karl 'vollmerk' Vollmer 2006-10-12 23:42:09 +00:00
parent 8257b8bd4b
commit 5d8360f53d

View file

@ -1,10 +1,9 @@
// Copyright Ampache.org 2001 - 2006 // Copyright Ampache.org 2001 - 2006
// All Rights Reserved // All Rights Reserved
// Origional Author Kevin Riker // Origional Author: Kevin Riker
// Updated to handle post and XML Get by Karl Vollmer // Added Multi-Value XML based GET/POST replacement * Karl Vollmer
// Published under the GNU GPL // Licensed under the GNU/GPL
//var xmlDoc = null;
var http_request = false; var http_request = false;
var IE = true; 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);
}