Accroding to your codes,I suggest you could loop the ajax and set two variables of "lat" and "lon".Then you could assign the value of the item variable to two data.
Since I don't know your url,so I creat a little test for you.
More details,you could refer to below codes:
<script type="text/javascript">
$(document).ready(function () {
var lat = '';
var lon = '';
var value = [
{
"lat": "45.9606152",
"lon": "13.641309",
},
{
"lat": "47.8006152",
"lon": "15.641309",
}
];
$.each(value, function (i, item) {
$.ajax({
type: "POST",
url: ("https://nominatim.openstreetmap.org/reverse.php?lat=" + item.lat + "&lon=" + item.lon + "&zoom=16&format=json"),
contentType: "application/json",
success: function (data) {
alert(item.lat + "," + item.lon);
alert(JSON.stringify(data));
},
});
});
});
</script>
Best regards,
Yijing Sun
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
65 Points
194 Posts
jquery problem post more time
Jan 09, 2020 08:38 AM|progy85|LINK
Hi,
I need to alert two different data with my code but I don't have idea how to do this.
From my database I have like this:
var latlon = "45.9606152,13.641309 - 47.8006152,15.641309 "
Reverse is separate with "-" In my case I need to post two times, and display two alert for each data.
Contributor
3730 Points
1412 Posts
Re: jquery problem post more time
Jan 10, 2020 08:17 AM|yij sun|LINK
Hi progy85,
Accroding to your codes,I suggest you could loop the ajax and set two variables of "lat" and "lon".Then you could assign the value of the item variable to two data.
Since I don't know your url,so I creat a little test for you.
More details,you could refer to below codes:
Best regards,
Yijing Sun