AJAX请求在移动设备上发回相同的内容,但不在桌面上发送

时间:2017-12-19 00:03:00

标签: jquery ajax jquery-mobile

我设置了一个页面,用于在页面加载时从页面请求10次信息。在桌面上,它会发回并显示10个不同的用户。但是,在Mobile上,它会返回相同的用户信息。

这是我的jQuery代码:

$( document ).ready(function() {
   var i = 0;
   while(i < 10)
     {
            $.ajax({
                   type: "POST",
                   url: "./func/gather.func.php",
                   data: {}, // serializes the form's elements.
                   success: function(data)
                   {
                    var response = $.parseJSON(data);
                    $('.posts').append('<div class="post" id="post-'+ response[0].streamID_gather +'"><div class="title-card"><div class="avatar-sec"><img src="'+ response[0].avatarSrc +'" class="avatar" ref="Avatar" /></div><div class="name-card"><span class="display-name">'+ response[0].display_name +'</span><span class="handle">@'+ response[0].name +' '+ response[0].followsYou +'</span></div><div class="action"><span class="like" id="like">'+ response[0].amt +' <i class="fa fa-heart-o" aria-hidden="true"></i></span></div></div><div class="body-card">'+ response[0].p_message +'</div><div class="footer"><div class="follow-button '+ response[0].follow +'" id="'+ response[0].streamID_gather +'">'+ response[0].follow +'</div></div></div>');
                    }
                 });
        i++;
     }  
   });

这是加载页面时的桌面视图

Desktop View

以下是加载页面时的移动视图

Mobile view

0 个答案:

没有答案
相关问题