Ajax 是否可以通过id从responsetext获取元素而不首先打印出来?

Ajax 是否可以通过id从responsetext获取元素而不首先打印出来?,ajax,Ajax,来自xmlhttp的响应如下 function somefunction() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.

来自xmlhttp的响应如下

function somefunction()
{
var xmlhttp;

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert(xmlhttp.responseText.getElementById('someid').innerHTML);
}
}
xmlhttp.open("GET","1.php",true);
xmlhttp.send();
}
但它不起作用

还有别的办法吗

提前感谢

在jquery中,您可以

alert(xmlhttp.responseText.getElementById('someid').innerHTML);
$.ajax({
键入:“获取”,
url:“1.php”,
contentType:“应用程序/json;字符集=utf-8”,
数据类型:“json”,
成功:功能(响应){
警报($('SomeID',response.d));
警报($('SomeID',$('.html(response.d));
},
故障:功能(msg){
警报(msg);
}
alert(xmlhttp.responseText.getElementById('someid').innerHTML);
$.ajax({
type: "GET",
url: "1.php",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
    alert($('#SomeID',response.d));
    alert($('#SomeID',$('<div/>').html(response.d)));
},
failure: function(msg) {
    alert(msg);
}