注册 登录
编程论坛 jQuery论坛

困扰三天的问题求大神帮忙

ahjbliss1 发布于 2015-04-03 22:52, 4466 次点击
本人新手一枚,最近遇到一个小问题就是
function httpRequest(reqType,url,async,resFun,paramter){
    var request =null;
    if(window.XMLHttpRequest){
    request = new XMLHttpRequest();
    }else if(window.ActiveXObject){
    request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if(request||typeof(request)=="object"){

    if(reqType.toLowerCase()=="post"){
   

    request.open(reqType,url,true);
    request.open('post','http://localhost:8081/study/startExam',true);
    request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    request.onreadystatechange=resFun;
    parameter = encodeURI(paramter);
    alert('http://localhost:8081/study/startExam'+parameter);
    request.send(parameter);
    }else{
    url=url+"?"+paramter;

    request.open(reqType,url,true);
    request.onreadystatechange=resFun;
    request.send(null);
    }
    }else{
    alert("brower do not support AJAX!")}
    return request;
}
在    request.open('post','http://localhost:8081/study/startExam',true);这块一直没有执行,我alert这段代码后得到undefined
我以为url地址问题,结果window.open(url)也是可以打开的?
为什么啊?不能理解了。打开的就是服务器servlet的地址而已啊怎么会这样子
2 回复
#2
ahjbliss12015-04-03 22:59
没人理我求帮助啊
#3
ahjbliss12015-04-05 17:35
已解决!就此结贴
1