基础 - jQuery的Ajax

$(function(){

    $.ajax({
        url: "https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su",
        type: "GET",
        dataType: "jsonp",
        jsonp: "cb",
        data:{"wd":"冰"},
        success: function (data) {
            console.log(data);
        },error: function (data) {
            console.log(data);
        }
    });

})

  

            var aElement = data.s;
            $.each(aElement, function (index,element) {
                console.log(index,element);
            });

  

            var oUl = $("<ul></ul>");
            $("#box").append(oUl);
            
            var aElement = data.s;
            $.each(aElement, function (index,element) {
                console.log(index,element);
                var oLi = $("<li></li>").append(element);
                oUl.append(oLi);
            });

  

  

posted @ 2016-09-05 11:26  WeWeZhang  阅读(101)  评论(0编辑  收藏  举报