I submit some data via AJAX post and when I get receive response I output it via a loop.
$.each(data, function() {
$("#em").append('<i class="bi bi-pin-map-fill'+(lat == this.lat && lon == this.lon ? " bg-danger" : "")+'"></i> '+this.lat+' '+this.lon);
let lat = this.lat,
lon = this.lon;
}
In some case the coordinates I receive could be of the exact same location, so I'd like to be able to mark those duplicates by adding background color. So I've added a condition to check for matches but am blanking how to implement it, since I can't really set the vars at the end of my loop... Need some nudge in the right direction.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2h9x0vs
Comments
Post a Comment