ajax调取接口

 getData = function(uid) {
        alert(uid);
        $.jsonp({
            url:"http://192.168.1.169:9543/auth/login",
            data:JSON.stringify({
                username:"liangtou",
                password:"admin"
            }),
            type:"POST",
            contentType: "application/json; charset=utf-8",
            dataType:"json", //返回数据的类型
            success:function(re){
                console.log(re);  //在console中查看数据
                alert('success!');
            },
            error:function(re){
                alert(JSON.stringify(re));
            },
        });
    }

  

posted on 2019-03-13 15:54  爱学习的亮亮  阅读(150)  评论(0)    收藏  举报

导航