针对正确jQuery对象的问题

针对正确jQuery对象的问题,jquery,json,object,Jquery,Json,Object,我的测试页面当前正在显示:这是一个好迹象,有些东西正在显示,但显示不正确。 我有以下jQuery对象: reviews: Array[3] 0: Object excerpt: "Everything I have had here is insane. SO GOOD. I always get a tuna baguette. Normally, the bread on sandwiches is just what holds it together, but her

我的测试页面当前正在显示:这是一个好迹象,有些东西正在显示,但显示不正确。 我有以下jQuery对象:

reviews: Array[3]
 0: Object
    excerpt: "Everything I have had here is insane. SO GOOD. I always get a tuna baguette. Normally, the bread on sandwiches is just what holds it together, but here it..."
    id: "yVT2R7JQ5WRgVXZ-LrnJhQ"
    rating: 5
    rating_image_large_url: "http://media1.ak.yelpcdn.com/static/20101216354709277/img/ico/stars/stars_large_5.png"
    rating_image_small_url: "http://media3.ak.yelpcdn.com/static/201012161949604803/img/ico/stars/stars_small_5.png"
    rating_image_url: "http://media3.ak.yelpcdn.com/static/201012162578611207/img/ico/stars/stars_5.png"
    time_created: 1323827891
    user: Object
    __proto__: Object
1: Object
2: Object
我希望它只显示一个“来自Yelp.com的44条评论”,而不是10条。。。我不知道如何正确地进入这个对象树,并针对正确的元素。我用这个脚本来显示他们,但我不明白为什么它不能正确显示

以下是脚本:
函数showData(数据){
$.each(data.name,function(i,business){
//额外回路
var bizContent='

'; $(bizContent).appendTo('yelpAVG'); $。每个(数据审查,职能(i,审查){ var content='在'+review.date+'via'上发布; 内容+=''; 内容+='
'; content+=review.text_摘录+'

; 内容+='
'; $(内容)。附加到(“#预览”); }); }); };
感谢您的帮助和指导
感谢阅读

尝试将
bizContent
附加移出循环:

function showData(data) {
    var bizContent = '<p><img src="' + data.rating_img_url + '" img=""/><br><a href="' + data.url + '">' + data.review_count + ' reviews from Yelp.com</a></p>';
    $(bizContent).appendTo('#yelpAVG');
    $.each(data.name, function(i, business) {
         // extra loop 
        $.each(data.reviews, function(i, review) {
            var content = '<div class="comments-block"><p>Posted by <a href="' + review.user_url + '">' + review.user_name + ' </a> on ' + review.date + 'via <a href="' + review.url + '">Yelp.com</a>';
            content += '<img src="' + review.user_photo_url + '" img=""/>';
            content += '<p><img src="' + review.rating_img_url + '" img=""/><br>';
            content += review.text_excerpt + '</p>';
            content += '<p><a href="' + review.url + '">Read the full review</a><br>';
            $(content).appendTo('#yelpReviews');
        });
    });
};
函数showData(数据){
var bizContent='

'; $(bizContent).appendTo('yelpAVG'); $.each(data.name,function(i,business){ //额外回路 $。每个(数据审查,功能(i,审查){ var content='在'+review.date+'via'上发布; 内容+=''; 内容+='
'; content+=review.text_摘录+'

; 内容+='
'; $(内容)。附加到(“#预览”); }); }); };

我不确定您是否真的需要第一个循环。

非常感谢!!!这解决了这个问题,但你知道为什么它显示“未定义”的审查?我想不出我应该调用什么样的键或对象或目标
function showData(data) {
    var bizContent = '<p><img src="' + data.rating_img_url + '" img=""/><br><a href="' + data.url + '">' + data.review_count + ' reviews from Yelp.com</a></p>';
    $(bizContent).appendTo('#yelpAVG');
    $.each(data.name, function(i, business) {
         // extra loop 
        $.each(data.reviews, function(i, review) {
            var content = '<div class="comments-block"><p>Posted by <a href="' + review.user_url + '">' + review.user_name + ' </a> on ' + review.date + 'via <a href="' + review.url + '">Yelp.com</a>';
            content += '<img src="' + review.user_photo_url + '" img=""/>';
            content += '<p><img src="' + review.rating_img_url + '" img=""/><br>';
            content += review.text_excerpt + '</p>';
            content += '<p><a href="' + review.url + '">Read the full review</a><br>';
            $(content).appendTo('#yelpReviews');
        });
    });
};