I would like to place the results of an API request into Caspio table record fields. I have been successful in accomplishing this with google address geocoding. However, I would like to use a reverse geocoding API from the Census Bureau and I cannot insert the results. I seem to be able to receive the proper response using the Chrome console. But, I cannot receive the request and insert it into a table record field. Right now, I am just to try to insert one response value. Below is the script that I am inserting into the Footer (with fixed lat/long values to test).
Thanks,
Anthony
<script>
var longitude = '-78.8904516'
var latitude = '36.0054348'
var url1 = 'https://geocoding.geo.census.gov/geocoder/geographies/coordinates?x=' + longitude + '&y=' + latitude + '&benchmark=4&vintage=4&layers=10&format=jsonp'
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
aefax
Hello,
I would like to place the results of an API request into Caspio table record fields. I have been successful in accomplishing this with google address geocoding. However, I would like to use a reverse geocoding API from the Census Bureau and I cannot insert the results. I seem to be able to receive the proper response using the Chrome console. But, I cannot receive the request and insert it into a table record field. Right now, I am just to try to insert one response value. Below is the script that I am inserting into the Footer (with fixed lat/long values to test).
Thanks,
Anthony
<script>
var longitude = '-78.8904516'
var latitude = '36.0054348'
var url1 = 'https://geocoding.geo.census.gov/geocoder/geographies/coordinates?x=' + longitude + '&y=' + latitude + '&benchmark=4&vintage=4&layers=10&format=jsonp'
function gogeo() {
$.ajax({
url: url1,
dataType: 'jsonp',
success: function(Response) {
console.log(Response);
successCallback(Response)
},
error: function(error) {
console.log(error);
}
});
return Response.result;
function successCallback(Response){
var geoid1 = Response.result.geographies["Census Block Groups"]["0"].GEOID;
geoid1 = Number(geoid1);
document.getElementById("InsertRecordgeoid").value =geoid1;
}
}
gogeo()
</script>
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.