get

English [get] US [ɡ?t]

vt.??;??(?? ?)

vt.& vi. ???? ?? ????

JSON

??? ??; ?? ??? ?? ??;

??? getJSON() ?? ???

??: jQuery 1.2??? "myurl?callback=?"? ?? JSONP ??? ?? ??? ???? ?? ????? JSON ???? ??? ? ????. jQuery? ?? ??? ???? ?? ?? ??? ?? ???? ???? ?????. ??: ? ?? ??? ???? ?? ? ? ?? ??? ?????.

??: ??jQuery.getJSON(url,data,success(data,status,xhr)

????:

?? ??. ??? ?? ??? ???? ???? ?????. success(data,status,xhr)?? ??. ?? ????: response - ?? ??? ?? ???? ?????. - ?? ??? ?????: url,data: data, Success: callback,dataType: json}); ??? ??? ???? ?? ???? URL? ??? ? ????. ??? ????? ?? ??(?)? ?? ???? ?? URL? ?????. ??? ? URL ????? ???? ??? ???? ?? ???? JavaScript ????? JSON? ??? ??? ? ????. ??? ??? $.parseJSON() ???? ???? ?? ?????.

??? getJSON() ?? ?

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $.getJSON("這里是你的json 文件地址",function(result){
      $.each(result, function(i, field){
        $("p").append(field + " ");
      });
    });
  });
});
</script>
</head>

<body>

<button>獲得 JSON 數(shù)據(jù)</button>
<p></p>

</body>
</html>

    <span id="budo4"><optgroup id="budo4"></optgroup></span>

    ParametersDescription
    url ?? URL? ???? ????