I am working on a jsp file, which has a span tag as shown below:
<span id="divBasicSearchResults" style="height:100%;"></span>
the Javascript file that renders html code on this span is shown below:
function renderBasicSearchNarrative1(response) {
var html = '';
var i = 0;
var j = 0;
if(response){
html += '<table><tr><th colspan="5">Search Results</th></tr>';
html += '<tr><td><b>#</b></td><td style="min-width:150px;"><b>Name</b></td><td><b>Lat/Long</b></td></tr>';
html += '<tbody>';
for(var i =0; i < response.length; i++){
var result = response[i];
var resultNum = i+1;
if(result.lat>47.33 && result.lat<48.92 && result.lon>9.8 && result.lon<13.46){ //this loop is to restrict the results to Munich
html += "<tr valign=\"top\">";
html += "<td>" + resultNum + "</td>";
html += "<td>";
if(result.display_name){
var new_display_name = result.display_name.replace(/,/g, ",<br />");
html += new_display_name;
}
html += "</td>";
html += "<td>" + result.lat + ", " + result.lon + "</td>";
addmarker(result.lat, result.lon, "map-pointer-icon.png");
html += "</tr>";
} //end of for loop for Munich
}
html += '</tbody></table>';
}
document.getElementById('divBasicSearchResults').style.display = "";
document.getElementById('divBasicSearchResults').innerHTML = html;
Now, in this above code I am generating an html code dynamically which is supposed to be rendered on the jsp file. But the problem which I am facing that I cannot see the whole html code which is dynamically generated, instead I just see the header data of the html code on my span tag. The result which I see on the span tag is:
Search Results
#Name Lat/Long
Thanks in advance for reading this text, waiting for suggestions.