如何使用JavaScript读取和加载不同的Json文件? 例如:Json1,Json2,Json3,Json4 一些循环,每30秒加载一次不同的Json
正在尝试和寻找,如何制作,但没有任何作品对我来说,任何想法?
希望包含在此代码中
function loadpoints() { function getData(){
$.getJSON('pointer.json', function(pointer) {
var latlngbounds = new google.maps.LatLngBounds();
$.each(pointer, function(index, ponto) {
//where its my data working
var marker = new google.maps.Marker({
position: new google.maps.LatLng(ponto.lat, ponto.lon),
title: ponto.activity,
icon: ponto.activity + '.png',
map: map
});
console.log("created marker " + marker.position)
});
setTimeout (getData, 3000); });
}
getData();
}
答案 0 :(得分:0)
@Mojtaba
function genereteRamdon (min, max){
var arr=[];
while (arr.length<4){
var randomNumber = Math.floor(Math.random() * (max-min+!))+min;
found=false;
for (var i=0, i<arr.length; i++){
if (arr[1] = randomNumber){found=true; break}
}
return arr;
}
}
$.getJSON('pointer.json', function(pointer) {
var latlngbounds = new google.maps.LatLngBounds();
$.each(pointer, function(index, ponto) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(ponto.lat, ponto.lon),
title: ponto.activity,
icon: ponto.activity + '.png',
map: map
});
console.log("created marker " + marker.position)
}
答案 1 :(得分:0)
你想要得到的东西不太清楚。
我想你想要这个:
function getData(){
$.getJSON('pointer.json', function(pointer) {
var latlngbounds = new google.maps.LatLngBounds();
$.each(pointer, function(index, ponto) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(ponto.lat, ponto.lon),
title: ponto.activity,
icon: ponto.activity + '.png',
map: map
});
console.log("created marker " + marker.position)
});
}
getData();
setInterval(getData, 30000);
答案 2 :(得分:0)
解决方案:)
这段代码正在寻找
public string UpdateVideo(long id, FormCollection form)
{
string vToken = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath).AppSettings.Settings["vzaar.token"].Value;
string vSecret = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath).AppSettings.Settings["vzaar.secret"].Value;
com.vzaar.api.Vzaar api = new com.vzaar.api.Vzaar(vSecret, vToken);
com.vzaar.api.VideoEditQuery videoedit = new com.vzaar.api.VideoEditQuery();
videoedit.id = CurrentVideo.VzaarID;
videoedit.markAsPrivate = false;
videoedit.title = CurrentVideo.Title;
videoedit.description = CurrentVideo.Description;
videoedit.seoUrl = "";
bool apireply = api.editVideo(videoedit);
}