MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 关于Ajax的有关问题,

关于Ajax的有关问题,(3)

www.MyException.Cn  网友分享于:2013-02-25  浏览:9次

var dep=null; 
function getMembers(sunn){ 
if(sunn!="null"){ 
hideMenu(); 
dep = sunn; 
var url="select.jsp"; 
var params = 'sunn=' + sunn; 
sendRequest(url,params,'GET',showMembers); 

}
------解决方案--------------------
给你一个httpRequest函数:
JScript code


function GetXMLBlock(url)
{
    var req=null;
    try 
    {
        req = new XMLHttpRequest();
    } catch (e) {
        alert("GetXMLBlock 1");
        req = null;
    }
    if (!req && typeof(ActiveXObject) != "undefined"){
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    try {
        var a = req.open('GET', url, false);
        //req.setRequestHeader("If-Modified-Since","0"); 
        req.setRequestHeader("Content-Type","utf-8"); 
        req.send(null);
        if (req.readyState == 4)
        {
            if (req.status == 200) 
            {
                return req.responseXML;
            }
            alert("GetXMLBlock 2:"+req.status);
            return null;
        }
    } catch (ex) 
    {
        alert("GetXMLBlock 3 :"+ex);
        return null;
    }
    alert("GetXMLBlock 4");
    return null;
}

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有