jQuery ajax请求 一般请求和自定义请求

 
//一般post请求
       $.ajax({
                type:"POST",
                url:url,
                async:false,
                data:Data,
                dataType:'json',
                success:function(data){
                     console.log(data);
                }
            });
//特定请求头的请求    application/json
 
    
             url = "http://*************:8080/biz-services/sdk/qryGroups/offline"
            Data = {pageCategoryType:pageCategoryType,pageId:pageId,day:day},
            $.ajax({
            type:"POST",
            url:url,
            // async:false,
            contentType: 'application/json;charset=UTF-8',
            headers: {
                 'Accept': 'application/json',
                 'Content-Type': 'application/json'
            },
            dataType:'json',
            data: JSON.stringify(Data),//对请求参数进行json转化
            success:function(data){
                console.log(data.datas);
                if(data.result == 1){
                    return
                }
            }
        });
posted @ 2018-12-20 16:07  韩冷耀  阅读(594)  评论(0编辑  收藏  举报