Я пытаюсь показать <Candidate></Candidate>
в округе Ратленд с только голосами выше 0. Сейчас он показывает их всех только в округе Ратленд.Только XML только <Candidate></Candidate> если голосов> 0
https://jsfiddle.net/jeffd/yqbwaxts/3/
https://99centbeats.com/ResultsData.xml
So Far:
$(document).ready(function() {
$.ajax({
type: 'GET',
url: 'https://99centbeats.com/ResultsData.xml',
//url: 'https://vtelectionresults.sec.state.vt.us/rss/2713/ResultsData.xml',
crossDomain: true,
success: parseXml
});
});
function parseXml(xml) {
$(xml).find('Town').each(function() {
var county = $(this).find('County').text(); //change to county for 'County'
window.votes = $(this).find('Votes').text();
if (county == 'RUTLAND') { // change to 'RUTLAND' for Rutland County
if (votes !== '0'){
window.townname = $(this).find('TownName').text();
window.officename = $(this).find('OfficeName, Name, Votes');
var newItems = $.map(officename, function(i) {
$(i).filter('0')
return $(i).text();
});
newItems2 = ("" + newItems).replace(/,/g, " - ");
$(".marquee").append(' - <strong>' + townname + '</strong>' + ' - ' + newItems2);
}
}
});
$('.marquee').marquee({
duration: 5000 // Speed of the counter (Lower = Faster)
});
}
setTimeout(function() {
window.location.reload(1);
}, 300000); // Refresh Results Every 5 Minutes
Благодаря JKRishe, вы гений! – Jeff
@Jeff Добро пожаловать и благодарю вас за то, что вы положили мне хорошее слово в моей компании. Очень признателен. :) – JLRishe