1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <script language='javascript'>
var xhr = null;
var xmldocument;
function getxhr(){
if(window.XMLHttpRequest){
xhr = new XMLHttpRequest();}
else if(window.ActiveXObject){
xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
else{alert("incomptatible Ajax");}
if(xhr){
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
xmldocument = xhr.responseXML;
} } }
xhr.open("POST", "test.txt", true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
var data = "toto";
xhr.send(data);
}
</script> |
Partager