Weather api need help

Can someone please tell me why I keep getting lat not defined?

$(document).ready(function() {
  //show location
  var data;
$.getJSON('', function(d){
        var lat = latitude;
        var lon = longitude;        
        var loc = lat,lon;

//console.log(response.ip,, response.region);

The latitude and longitude values you are trying to assign to var “lat” and var “lon” do not exist.
You stored the latitude and longitude in an array you called “data”. The array does not “know” that the first value in the array is a latitude and the second a longitude. You must access the values in the array with their index.

Have you tried following the link ? You will see exactly what properties the returned object has.

Your data=d.loc.split(","); is a good start. It created an array that looks like that :
["12.3456", "-12.3456"] . Now try to assign the value of the first item in the array (“12.3456”) to your latitude variable.

Try that first and come back if you still struggle with it!

thank you for your response!
I got it…

$(document).ready(function() {
//show location
var data;
$.getJSON(‘’, function(d){
var city = d.loc[0];
var region = d.loc[1];
var loc = [0,1];
$("#location").text( + " , " + d.region);

1 Like

Now I am getting a net::ERR_EMPTY_RESPONSE when I add the next section.
GET,-74.4026callback=jQuery1112044735759682009135_1499026979985&_=1499026979986 net::ERR_EMPTY_RESPONSE

here is the code:
//get summary
dataType: “jsonp”,
success: function(data1) {

    var city =;
    var region = data1.region;
   var condition = data1.currently.summary;