ajax JS和JQ写法

function validate(){  
 
   		var data=[];
        var xhr= new XMLHttpRequest();
        xhr.open("post","http://admin.weixuegu.cn/api/course.Course/delete?id=1",true);
        xhr.send(data);
        xhr.onreadystatechange=function(){
            if(xhr.ststus==200&&xhr.readyState==4){
                var res=xhr.responseText;
                console.log(res);
            }
        }
   } 
</script>

JQ

//1\GET
$.ajax({
            type:"GET",
            url:" https://api.passport.xxx.com/checkNickname?username="+mylogin.username+"&token="+mylogin.token+"&nickname="+nickname+"&format=jsonp&cb=?",
            dataType:"json",
            success:function(data){
                if(data.errorCode==0){
                                         $("#nickname").val(mylogin.nickname);                             
                                 }else{
                                         $("#nickname").val("用户");                         
                                 }
            },
            error:function(jqXHR){
                console.log("Error: "+jqXHR.status);
            }
        });
//2\post
$.ajax({
        url:"http://api.passport.pptv.com/v3/login/qrcode.do",
        type:"post",
        dataType:"jsonp",
        data:{from:"clt",qrid:qrid,username:username,token:token},
        success:function(data){
             try {
                    var p = external.GetObject('@xxx.com/passport;1');
                    p.On3rdLogin2(0,0,data,true);
                } catch (e) {
                    return false;
                }
                setTimeout(function () {
                    try {
                        var wb = external.Get('Signin2Window');
                        wb.OnClose();
                    } catch (e) {
                    }
                }, 200);
        }
    });