ajax查询怎么写 不要用prototype、jquery 纯JS的哈

[code="java"]

条码:

[/code]

[code="java"]<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



Insert title here

window.onload = function() { var request = null; document.getElementById("form").onsubmit = function() { //可以显示正在查询的图片 try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } } var url = this.action + "&barCode=" + escape(document.getElementById("barCode").value); request.open("GET", url, true); request.onreadystatechange = callback; request.send(null); return false; }; function callback() { if (request.readyState == 4) { if (request.status == 200) { //处理返回的内容 alert(request.responseText); } } } };


条码:


[/code]

[code="java"]
var xmlhttp;
function ajax(){
if(window.ActiveXObject){
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
var url = "自定义";
xmlhttp.open("GET",url,true);
xmlhttp.onreadystatechange = openURL;
xmlhttp.send(null);
}

    function openURL(){
        if (xmlhttp.readyState == 4){
            if (xmlhttp.status == 200){
                var json = xmlhttp.responseText;//返回的结果
                window.open(json.authorizeUrl);
            }
        }
    }

[/code]

参考这个
http://blog.csdn.net/dncts/article/details/6189411

我觉得如果可以的话,从goolge。