jquery常用ajax请求

$.ajax({
    type: "post",//请求方式
    url: "http://www.baidu.com",//请求地址
    data: {
        "id":"1"
    },//请求参数
    cache: false,
    async : true,
    dataType: "json",//返回数据为json
    success: function (rey)
    {
       console.log(rey)//请求成功后,返回数据
    },
    error:function (XMLHttpRequest, textStatus, errorThrown) {
         console.log("请求失败!")//请求错误
    }
});
    

 

posted @ 2020-10-16 15:11  非凡云  阅读(103)  评论(0)    收藏  举报