javascript - JSON information is looped once -


so problem i'm loading json files url html , it's working besides fact shows information twice.. know why case?

here's jquery/javascript code use load json html.

$.ajax({     url: 'http://datatank4.gent.be//bevolking/totaalaantalinwoners.json',     datatype: 'json',     type: 'get',     cache: false,     success: function(data) {         = 0;         var access;         var url;         $(data).each(function(index, value) {             wijkname = value.wijk;             year = value.year_2010;             i++;             $('#pagewrap2').append(                 '<div class="dataond col col-xxs-12 col-md-3"> <h2> ' + wijkname + '</h2><p>' + year + '<div id="maps">' + "<iframe width='100%' height='100%' frameborder='0' scrolling='no'  marginheight='0' marginwidth='0'   src='https://maps.google.com/maps?&amp;q="+ encodeuricomponent( wijkname + ' ' + 'gent' ) +"&amp;output=embed'></iframe>" + '</div>' + '</p></div>'             );         });     } }); 

first check response of ajax call.

if response fine maybe you're making ajax call twice.

for example when add event listener twice. (add off() function before click() if you're using jquery)


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -