fetch jsonp请求接口

function loadTbbRec() {
    var fetchJsonp = require('fetch-jsonp');
    fetchJsonp(ext.info.tbbRecUrl, {
        headers: {
            'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
        },
        jsonpCallback: 'callback',
        credentials: 'include'
        
    }).then(function (res) {
        var obj = res.json();
        obj.then(function(data) {
            var str = '';
            var i;
            for (i in data) {

            }

            $('#carlist').append(str);
        });
        
    }).then(function (data) {
        console.log(data);
    });
}
原文地址:https://www.cnblogs.com/dongruiha/p/7682934.html