Не могли бы вы просто сделать два экземпляра XMLHttpRequest
?Таким образом, вы можете иметь:
Получить
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp1=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp1.onreadystatechange=function()
{
if (xmlhttp1.readyState==4 && xmlhttp1.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp1.responseText;
}
}
xmlhttp1.open("GET","ajax_info.txt",true);
xmlhttp1.send();
}
</script>
</head>
<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>
</html>
POST
<html>
<head>
<script type="text/javascript">
function loadXMLDoc2()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp2=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp2.onreadystatechange=function()
{
if (xmlhttp2.readyState==4 && xmlhttp2.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp2.responseText;
}
}
//Set POST params
var params = "lorem=ipsum&name=binny";
xmlhttp2.open("POST","ajax_info.txt",true);
xmlhttp2.send(params);
}
</script>
</head>
<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc2()">Change Content</button>
</body>
</html>
Все, что я изменил, было именемобъект xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP")
и xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP")
Взято из W3Schools http://www.w3schools.com/ajax/default.asp