leaflet – Trying to return value from JSON in url using jQuery

I’m trying to get a value from a JSON on a dedicated URL that I can then use as a var. I want to take that value and put it into a Leaflet popup so it just needs to be the value (preferably in a float format).

Here is the JSON URL: waterservices.usgs.gov/nwis/iv/?format=json&sites=07344400&parameterCd=00065,63160&siteStatus=all

I know the place to get the value, which is $(‘#gageht’).val(json.value.timeSeries[0].values[0].value[0].value);

What I can’t figure out is the jQuery function to return this as a value outside of the function. I got this originally from here waterservices.usgs.gov/rest/IV-Service.html#Example

I got it so that the value I want pops up in the form using the place where the value is. I’m just lost on how to get it home.

Read more here: Source link