在加载页面时,我的getJSON
调用将其输出显示到 div(称为 myDiv)。
现在我想在页面末尾添加一个按钮,当用户单击该按钮时,我想再次调用getJSON
,但这次我想将 page_number 增加一,每次用户单击按钮时在先前结果的末尾显示新结果。你们能告诉我我该怎么做吗?
<head>
<script>
//var counter = 1;
$.getJSON('http://anyorigin.com/get?url=https://www.myothersite.com/getit.php?page_number=+counter&type=TopVideos&sortBy=newest&callback=?', function(data){
var siteContents = data.contents;
//writes to textarea
document.myform.outputtext.value = siteContents;
document.getElementById("myDiv").innerHTML=siteContents;
$('#loadingimg').hide();
});
</script>
</head>
<body>
<div class="MainDiv">
<div class="MainContent">
<div class="ContentWidth">
<div id="JSListVideo" class="VideoList">
<div id="myDiv"></div>
和按钮代码:
<div class="MoreButtonSection">
<div class="RedButton">
<span class="LeftEnd"></span>
<span class="Centre">
<a href="javascript:void(0);" onclick="seemore();" title="See more">see more</a>
</span>
<span class="RightEnd"></span>
</div>
</div>