jQuery 库函数

jQuery.Ajax

// 简化模式:接收 json 数据

    $.getJSON("/api/article/channel", { "guid": guid }, function (res) {
    // success function   });

// 跨域模式:接收 jsonp 数据

    $.getJSON("http://api.domain.com/api/slider?callback=?", function (res) {
    
//success });

// 跨域模式完整版:接收 jsonp 数据

    $.ajax({
        url: "http://panel.xpet.com/api/home-slider",
        type: 'GET',
        dataType: 'JSONP',
        success: function (data) {
            //success
        }
    });

服务端JSONP数据返回格式:

string.Format("{0}({1})", request["callback"], 原json返回字符串)

$.each(array, function(){})的中断

在function中,使用return false;来实现break功能,使用return true;来实现continue功能。

原文地址:https://www.cnblogs.com/huhunet/p/7356810.html