jquery之getJSON


  1. $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?
    tags=cat&tagmode=any&format=json&jsoncallback=?", function(data){
    $.each(data.items, function(i,item){
    $("<img/>").attr("src", item.media.m).appendTo("#images");
    if ( i == 3 ) return false;
    });
    });

    2.$.getJSON("test.js", { name: "John", time: "2pm" }, function(json){
    alert("JSON Data: " + json.users[3].name);
    });

    3.该函数是简写的 Ajax 函数,等价于:
$.ajax({ url: url, data: data, success: callback, dataType: json });

你可能感兴趣的:(jquery,json)