通过ajax请求api数据

$(function () {
    $.ajax({
        type: "post",
        dataType: "JSONP",
        data: {f_sId: "2968d399-4402-4baf-b407-2b329f2a2c02", "f_sType": 18, "page": 1},
        url: "http://thanbach.com/YXShoppingMallApp/exclusiveShop_getExclusiveShopGoodsByType.jhtml",
        success: function (data) {
            var test = eval(data);
            var productList = '';
            for (var i = 0; i < test.rows.length; i++) {
                productList += '<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 product1"><a href="#"><img src="' + test.rows[i].f_sgImg + '"></a><h4>' + test.rows[i].f_pGoodsName + '</h4><span class="oldPrice">' + test.rows[i].f_gMarketPrice + '</span><span class="price">' + test.rows[i].f_pPrice + '</span><span class="youhui">' + test.rows[i].f_pPV + '</span></div>';
                $(".product").html(productList);
            }


        }
    });
})

欢迎分享本文,转载请保留出处:前端ABC » 通过ajax请求api数据

赞 (2)
分享到:更多 ()

发表评论 0