jquery中ajax写法

论坛 期权论坛 脚本     
匿名技术用户   2021-1-5 01:00   11   0
var data = {
 "level": 1,
 "name": dname,
 "brandCode": dcode,
 "mcid": dcid
}


//以下url中携带的参数为固定的
$.ajax({
 url: mycarhttp + "/api/cars/models?open_id=test&token=1ae954cfb7b05eb7f885524d6ef4a2c4",
 type: "get",
 data: data,
 dataType: "json",
 success: function(data) {
  ...
 }
})


//以下url正常情况
$.ajax({
 url: mycarhttp + "/api/cars/models",
 type: "get",
 data: data,
 dataType: "json",
 success: function(data) {
  ...
 }
})
//get请求携带参数
$.get(myhttp+'/intelligentDirectory/fitProductMatchJfcode.do?auto_type='+SI+'&auto_key=' + txt + "&type_id=" + type,function(data){
                    console.log(data);
}
//post请求携带参数
$.post('{:U("api/goods/category_sales")}', {
            'st': startime,
            'et': endtime,
            'group_id': sh,
        }, function (data) {
        console.log(data);
})

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP