make an ajax get request instead of window.open. Then you can receive the data in the success event of the ajax call instead of having it "go to the screen". It will just send back json that you can parse through to get whatever data you're needing from it.
Like to access the lat/lng from the success event if the ajax call, you'd just
let term = $("#getaddy").val();
$.ajax({
url: 'https://maps.googleapis.com/maps/api/geocode/json?address='+encodeURIComponent(term) + '&key=yourkey',
type: 'get',
success: function(data) {
if (data.status === 'OK') {
// Get the lat/lng from the response
let lat = data.results[0].geometry.location.lat;
let lng = data.results[0].geometry.location.lng;
// now do something with the data you got back
}
},
error: function(msg) {
// handle error
}
});
I assume you're using jquery since you mentioned getJSONP, so I wrote the above with jquery.
PS Now get yourself a new maps api key! This one is no longer any good since it was posted on a public forum. You don't want someone else using it and charging it to your account... Be careful about posting private keys in public.