Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
CamperBot
@camperbot
fez994 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 394 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
Federico Dente
@fez994
@SweetCodingInc Do you know how can i make those variables global instead of using them for a function? The problem is that i'm using the google API to get lat and lon based on address, then i use this coordinates to call a second Api wich shows solar radiations data
But doing so i get "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access."
Sweet Coding :)
@SweetCodingInc
@fez994 Do you have codepen for this?
@fez994 As for making lat and lon variables global, it's straightforward
var lat, lon;
$.getJSON(url, function(data) {
  lat = data.results[0].geometry.location.lat;
  lon = data.results[0].geometry.location.lng;

  useLatLon(lat, lon);
});

function useLatLon(lat, lon){
  // use them here
}
Federico Dente
@fez994
I'll post it on codepen but i'll remove the api keys
Sweet Coding :)
@SweetCodingInc
@fez994 did you try adding ?callback=? at the end of your 2nd api url? (after the api key)
Federico Dente
@fez994
no
Sweet Coding :)
@SweetCodingInc
try it see if that works
otherwise, you will have to read their docs and set appropriate headers
Federico Dente
@fez994
image.png
Got this error now
Sweet Coding :)
@SweetCodingInc
@fez994 sorry.. my bad.. you need to add &callback=?
I didn't notice you already had query parameters
Federico Dente
@fez994
image.png
@SweetCodingInc Now i get this weird sintax error
But i don't have any ":"
Sweet Coding :)
@SweetCodingInc
Yes.. that means the response is problematic
can you paste your url (removing &callback=?) in a new tab and see if you get the data?
Quantomistro3178
@Quantomistro3178
Hey
Sweet Coding :)
@SweetCodingInc
just verify it once
Quantomistro3178
@Quantomistro3178
is the fcc weather API working?
its not executing either the fail or the success functions, am I doing something wrong?
Matej Bošnjak
@mbosnjak01
@Quantomistro3178 Uncaught TypeError: arr[0].toUpperCase(...).join is not a function maybe this?
Quantomistro3178
@Quantomistro3178
oh, lemme check that
Federico Dente
@fez994
@SweetCodingInc What do you mean past our url in a new tab?
Ah nevermind i get it
Sweet Coding :)
@SweetCodingInc
:laughing:
Matej Bošnjak
@mbosnjak01
i just removed .join()
and worked
@Quantomistro3178
Quantomistro3178
@Quantomistro3178
Oh yeah, its working
Federico Dente
@fez994
@SweetCodingInc Still get the same ":" error
Quantomistro3178
@Quantomistro3178
but the temp and weather description isn't showing for some reason. Oh well, i'll look into that. @mbosnjak01 Thanks!
CamperBot
@camperbot
quantomistro3178 sends brownie points to @mbosnjak01 :sparkles: :thumbsup: :sparkles:
:cookie: 257 | @mbosnjak01 |http://www.freecodecamp.org/mbosnjak01
Sweet Coding :)
@SweetCodingInc
@fez994 yeah.. that's the problem with API
Matej Bošnjak
@mbosnjak01
temp is there :D
Quantomistro3178
@Quantomistro3178
got it to work
yeah, I found the mistake
Man, I'm really too lazy to add css and eye-candy to this project...is it worth it?
Federico Dente
@fez994
@SweetCodingInc Alright thank you anyway, gonna post on the API forum to get some help
CamperBot
@camperbot
fez994 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
api offline
Sweet Coding :)
@SweetCodingInc
@fez994 :+1:
Federico Dente
@fez994
image.png