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
Mac
@itchick85
There is some strange thing my portfolio page is doing need help nothing I tried so far has fixed the issue. http://codepen.io/itchick85/pen/vgvrBX
Johnny
@jtan3
@itchick85 what's the problem?
Ken Haduch
@khaduch

@pshiwakoti1 - you can use code similar to this:

  function getWeather() {
    $.ajax({
      url: "http://api.openweathermap.org/data/2.5/weather",
      //jsonp: "jsonp",
      dataType: "jsonp",
      data: {
        //id: "2172797",
        APPID: "YOUR_APPID_HERE",
        lat: latitude,
        lon: longitude,
        units: "metric" // get units in Celsius
      }
    }).done(function(data) {
      console.log("data = " + data);
      console.log("JSON String data =" + JSON.stringify(data));
      $("#msg").text(JSON.stringify(data));
    });
  }

Although I haven't tried that exact incantation lately, what it does is to take the latitude and longitude values, along with your APPID (you have to tweak those settings as appropriate) and it should return the JSON data as data in the .done function. (You might want to review the details of this function on the jQuery site - http://api.jquery.com/jQuery.ajax/)

You can then extract the data, which you have to figure out the particulars of, but it will be a JSON object that will have the values as you saw in your browser when you clicked the link. Then you can write those out to the HTML document as you wish.

CamperBot
@camperbot
khaduch sends brownie points to @pshiwakoti1 :sparkles: :thumbsup: :sparkles:
:cookie: 264 | @pshiwakoti1 |http://www.freecodecamp.com/pshiwakoti1
Mac
@itchick85
the image for page four not showing then my footer is mess up @jtan3
Johnny
@jtan3
@itchick85 you need to check your closing divs
@itchick85 page3 is missing its closing div
Mac
@itchick85
@jtan3 where tho because they all look closed
Johnny
@jtan3
@itchick85 if you click on the div with page3
Ken Haduch
@khaduch
@itchick85 - use the "Tidy HTML" option in the HTML panel (on the right) and then look at the indentations of the different sections. There are a few missing </div> tags near the bottom. Clean those up and it looks better.
Johnny
@jtan3
@itchick85 it should highlight the closing div
@itchick85 i think you nested page4 section in page3
Prakash Shiwakoti
@pshiwakoti1
@khaduch I tried to use your function
and I called it from my html button
It doesn't display anything
can you please look at my CodePen
Ken Haduch
@khaduch
@pshiwakoti1 - I'll spend a couple minutes, because I'm on my way to bed... but I came back to see if I could check out what you have.
@pshiwakoti1 -= you actually have to call the function getWeather to have it return any information. Call it after you get the return from your location code.
Prakash Shiwakoti
@pshiwakoti1
ok @khaduch thanks for your help.
CamperBot
@camperbot
pshiwakoti1 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: pshiwakoti1 already gave khaduch points
Prakash Shiwakoti
@pshiwakoti1
Im trying the way you told me to do
can you please clarify what you mean by you actually have to call the function getWeather to have it return any information. Call it after you get the return from your location code.
playingwithinfinity
@playingwithinfinity
I just don't get Minimax!
Ken Haduch
@khaduch
@pshiwakoti1 - there have to be some changes. The scope of the variables "latitude" and "longitude" are local to your initial $.getJSON function, so I made a change to the function to pass those values to it. I forked a copy of your pen with the changes - just to make it easier because I'm fading out... Here is the link - you can see where I added the call getWeather(latitude, longitude); after your location callback runs. Then I added a div in your HTML panel with the ID of "msg", because my function is dumping the raw weather data out there. You have to take it from there.
@playingwithinfinity - I haven't gotten into it, yet, but there was this article that came up in the freecodecamp email a day or two ago: https://medium.freecodecamp.com/how-to-make-your-tic-tac-toe-game-unbeatable-by-using-the-minimax-algorithm-9d690bad4b37#.d08xira9g - it looks like it might be helpful, if you haven't seen it?
at least I hope that helps...
khaduch @khaduch - and now going offline for the night... happy coding all!
Prakash Shiwakoti
@pshiwakoti1
can someone else help me?
Prakash Shiwakoti
@pshiwakoti1
anyone here
Franco Javier Danussi
@francodanussi
Goodnight campers, I'm trying to concatenate numbers in the input bar, doing the calculator project. I can't find the way to make that happen in a coherent way though. It looked pretty straight forward, but every time I press a button the input shows "undefined" before the number. Weird stuff.
https://codepen.io/francodanussi/pen/JEgVYo
Prakash Shiwakoti
@pshiwakoti1
can anyone help?
Franco Javier Danussi
@francodanussi
@pshiwakoti1 what are you doing? Can I help you?
Prakash Shiwakoti
@pshiwakoti1
Franco look at my CodePen
im trying to display the temperature data from Open Weather api I extracted from
Franco Javier Danussi
@francodanussi
Yes, I opened it.
Prakash Shiwakoti
@pshiwakoti1
does my code make sense?
Franco Javier Danussi
@francodanussi
your getWeather() method?
Prakash Shiwakoti
@pshiwakoti1
what about it
Franco Javier Danussi
@francodanussi
Tell me where I should look
Prakash Shiwakoti
@pshiwakoti1
I want to know how to display in html section
I believe I have the weather data ready
Franco Javier Danussi
@francodanussi
yes
Prakash Shiwakoti
@pshiwakoti1
someone helped me write getWeather() funcition
Franco Javier Danussi
@francodanussi
You got that right, I'm looking the JSON returned
Ok. You 've got to access the temp property and set it to an html with JQuery or with querySelector
Prakash Shiwakoti
@pshiwakoti1
whats that mean
Franco Javier Danussi
@francodanussi
You should declare a div in html, and assign that an id, then in javascript declare the innertext of that div equal to the JSON temp property