在页面加载时,我使用此代码显示数据库中的数据:
<script>
$(function feed(){
var page = 1;
var type = '<?php echo $filter ;?>';
var theData = {};
theData['page'] = 'profile';
theData['type'] = type;
theData['username'] = '<?php echo $user_data->username; ?>';
theData['get_activities'] = 'true';
$.ajax({
type: "POST",
url: "data.php",
data: theData,
dataType:'json',
success: function(data){
$("#activities").html(data.activity_feed);
if(page < data.total_pages){
$("#activities").after('<div id="loader"><button id="load_more_activities">Load more</button></div>');
}
}
});
$("#activity_container").on("click", "#load_more_activities", function(){
var next = page+=1;
var type = '<?php echo $filter ;?>';
var theData = {};
theData['page'] = 'profile';
theData['type'] = type;
theData['username'] = '<?php echo $user_data->username; ?>';
theData['get_activities'] = 'true';
theData['page_num'] = next;
$.ajax({
type: "POST",
url: "data.php",
data: theData,
dataType: "json",
success: function(data){
$("#activities").append(data.activity_feed);
if(next == data.total_pages){
$("#loader").html("No more data");
} else {
$("#loader").html('<div id="loader"><button id="load_more_activities">Load more</button></div>');
}
},
});
});
});
</script>
一切正常,但如果我刷新页面超过5或6次,或者如果load_more_activities函数被调用超过5或6次......那么就不会执行post并且我没有显示任何数据...
此代码有问题,或者我的主机提供商可能有一些限制吗?
执行发帖时:
未执行发帖时:
答案 0 :(得分:0)
我的主机提供商可以使用名为“username”或“password”的变量发送ajax数据。因此,当发生这种情况时,服务器会检测某种“暴力”,然后丢弃所有数据包。