getjson jquery parsing an array

前端 未结 3 1762
甜味超标
甜味超标 2021-01-06 06:40

Got the simplified array working see below

Following up on the complicated array to parse see here.


TLDR: Want to get each heading fro

3条回答
  •  旧巷少年郎
    2021-01-06 07:05

    $.getJSON(url,
        function(data){
          $.each(data.items, function(i,item){
          $('#testfield').html('

    ' + item.d.title + '

    '); }); });

    In this code you're going to end up replacing the HTML of the item with ID of 'testfield' with the value over and over ... you might want to try using jQuery.append to add all entries as you've specified above

    $.getJSON(url,
        function(data){
          $.each(data.items, function(i,item){
          $('#testfield').append('

    ' + item.d.title + '

    '); }); });

提交回复
热议问题