JSON file has multiple 0.json 1.json 2.json 3.json ...
Now the case is that JS can read the contents of the JSON file, but each time the new file is read the contents of the file is gone, I want to load the contents of the new JSON file, keep the previous read the content
Ask the Great God!!!
JS is:
var i = 0; Current file Header
Window.onload = function () {
var host = Window.location.host; Get Domain Name
function GetData () {
Read data by Page Count
var filename = i+ ". JSON";
i++;
$.getjson ("http://bendi.ceshi.com/" +filename, function (data) {
var $content = $ ("#content");
var html = ';
$jsontip. Empty ();//Clear Contents
$.each (data, function (Infoindex, info) {
HTML + = '
';
HTML + = '
- ';
HTML + = ";
HTML + = ";
HTML + = ";
HTML + = '' + info[' title "] + '
';
HTML + =";
HTML + = ' ';
HTML + = '
';
})
$content. HTML (HTML);//Display processed data
})
}
GetData ();
function Scrollhandler () {
$ ("#pullUpB"). Show ();
$ ("#pullUpA"). Hide ();
}
$ ("#pullUpB"). Click (function () {
GetData ();
Scrollhandler ();
});
}
Reply to discussion (solution)
Find the problem append () append new.
$.getjson ("http://bendi.ceshi.com/" +filename, function (data) {
You can save the data to a global array here.
You are covered, you should use append.
$content. HTML (HTML);//Display processed data
Switch
$content. Append (HTML);//Display processed data
$content. HTML (HTML);//Display the processed data traversal once, overwriting the previous thing
Additional use of Append