JSFiddle - React, Tailwind, and code Playground
HTML
<script>
function Foo(a, b) {
alert(a);
alert(b)
}
</script>
<div id="message" style="float:left;"></div>
<div id="message2" style="float:left;margin-left:50px;"></div>
CSS
#message {
background:red;
padding:10px;
}
.addresses {
background:green;
margin:10px 0px;
}
JavaScript
jQuery(document).ready(function () {
jQuery.ajax({
type: "GET",
url: "http://geocode-maps.yandex.ru/1.x/?geocode=43.2491,76.9198&sco=latlong&kind=house&results=7",
dataType: "html",
success: function (xml) {
jQuery(xml).find('featureMember').each(
function () {
var qwerty = $(this).find('name').text(),
pos123 = $(this).find('pos').text(),
coord = pos123.replace(/\ /g, ',');
var div = "<div class='addresses' onClick='Foo(" + coord + ");' >" + qwerty + " pos: " + pos123 + "<br/>";
$('#message').prepend(div);
});
}
});
});