0

尝试将此 json 文件中的数据附加到 html doc。这是脚本:

$(document).ready(function() {
  $.ajax({
    type: "GET",
    url: "Beer.json",
    dataType: "json",
    success: processBeer,
    error: function(){ alert("error"); }
  });
  function processBeer(data){
    $(".box").append("Hello");
  }
}

这是 HTML:

<div class="box" id='d'>


</div>
4

1 回答 1

1

您的脚本中有一个语法错误,可能会阻止它完全运行。.ready你永远不会关闭电话的paren

于 2013-07-19T18:10:25.907 回答