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
Ademola Adegbuyi
@ooade
@djidrovo1 do u av a mail.php??
@2Irina2 No, i expected you to pass a longitude and latitude in, like this http://api.openweathermap.org/data/2.5/weather?lat=10&lon=10&APPID=02c0da530b8cf7771cee190bae9256af
Dario Idrovo
@djidrovo1
@marhyorh no
Ademola Adegbuyi
@ooade
@2Irina2 Yeah, u re getting it, now handle the longitude and latitude variable with javascript, wrap it with $.getJSON
@djidrovo1 then you should remove the form action
Irina
@2Irina2
@marhyorh yeah but how do i store all the info given by this link? var weather = http://api.openweathermap.org/data/2.5/weather?lat=44.1833&lon=28.6500&APPID=433e5ac19c344d585ded5fba77c92ded" ?
greg
@wearenotgroot
@2Irina2 remember getJSON are asynchronous so you need to call the getJSON for the openweather inside the callback function of your getJSON for ipinfo
@2Irina2 you need to replace those lat and lon numbers with variables.
@2Irina2 the lat and lon values will come from the object in the result of your getJSON (ipinfo)
Irina
@2Irina2
@wearenotgroot oh yeah, i am aware of the fact that lat and lon should be variables.. they depend on the position of the user... but for now, i need to understand how to gather the data from the openweathermap api
@wearenotgroot for now, suppose i am the only user of this app and i am just using my lat and long just to understand how the weather api works
greg
@wearenotgroot
@2Irina2 well build the api request first then console log the data to study it or look at the example on the api doc on expected data(same thing you did in the ipinfo)
Ademola Adegbuyi
@ooade
@2Irina2 in your $.JSON, you can pass in a function and pass these parameters to it
@djidrovo1
<?php 
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "djidrovo1@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
if (mail($recipient, $subject, $formcontent, $mailheader)) {
    echo "Thank you!";
} else {
   echo "Error Occured";
}
?>

<form action="#" method="POST">
          <p class="form-align">Name</p> <input type="text" name="name">
          <p class="form-align">Email</p> <input type="text" name="email">
          <p class="form-align">Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
          <input class="btn" type="submit" value="Send">
</form>
Juan Moraza
@Morazajuan
how where should i add the toggle method in my code?
 $(window).load(function(){
    $('.tempf').hide();
});
$('.tempf,.tempc').click(function(){
    $('.tempf,.tempc').toggle();
});
thats what i been trying to put but doesnt work
Ademola Adegbuyi
@ooade
@2Irina2 you can have something like this
$.getJSON("http://ipinfo.io", function(data){
          data = { name: data.city + " " +  data.country, coords: {
            latitude: data.loc.split(',')[0], longitude: data.loc.split(',')[1]
          }}
          showPosition(data);
        })

function showPosition(position) {
    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;
    $.getJSON("http://api.openweathermap.org/data/2.5/weather?lat="+latitude+"&amp;lon="+longitude+"&APPID=02c0da530b8cf7771cee190bae9256af",function(data){
      var city = data.name;
      var temp = data.main.temp;
.... //and so on
Irina
@2Irina2
@marhyorh @wearenotgroot okay i think i am getting close.. please check what i did so far
I did this just to check if the values change on the webpage.. the "city" changes to Constanta but the "temperature" does not
greg
@wearenotgroot

@2Irina2 url can be --------->

'http://api.openweathermap.org/data/2.5/weather?lat='+ data.loc.split(',')[0]+'&lon='+data.loc.split(',')[1]+'&APPID=433e5ac19c344d585ded5fba77c92ded&callback=?'

remember variable(data from the previous getJSON) concatenate with the apiURL

Irina
@2Irina2
Oh okay now the temperature shows.. it was just a typo..
but there is still something not clear to me about the API Key
why does one need my API key to show the weather in some other place on earth?
why do i need to include it in the url?
greg
@wearenotgroot
@2Irina2 the api key is just to identify who sent the request(mainly to stop people from abusing it, also premium api key can use https(more secure connection))
Ademola Adegbuyi
@ooade
This message was deleted
Irina
@2Irina2
@wearenotgroot @marhyorh alright guys thank you so much for your help and patience.. i feel like i learnt a lot about this
CamperBot
@camperbot
2irina2 sends brownie points to @wearenotgroot and @marhyorh :sparkles: :thumbsup: :sparkles:
:star2: 1266 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
:warning: 2irina2 already gave marhyorh points
Ademola Adegbuyi
@ooade
YWC :smile:
greg
@wearenotgroot
@2Irina2 :+1: another thing api doc: http://openweathermap.org/current scroll down to the end and read about Units format, if you dont want (Standard units(temp in kelvin))
Henrique Salguero
@kikosalguero
Everytime i refresh de page i get a different result in the Status (Online/Offline) of the channel. Anyone have an idea why is that happening? http://codepen.io/kikosalguero/pen/bZxJRa
Vlad Fernandes
@Vlad-Fernandes
How do people get banned?
is it the language?
greg
@wearenotgroot
@vieira83 if they are being a general a male repoductive organ(being a D**K)
Vlad Fernandes
@Vlad-Fernandes
@wearenotgroot ???
didn’t understand
what you said
greg
@wearenotgroot
@vieira83 people get ban if they repeatedly use insults and harassing other community member
@vieira83 they will get a few warning before it happens
also if they keep spamming the chat they get a time out
Vlad Fernandes
@Vlad-Fernandes
ok
Juan Moraza
@Morazajuan
lol he meant being a jerk @wearenotgroot
@wearenotgroot do you think you could take a look at my code. Im having trouble with the toggle method
Tyler Moeller
@TylerMoeller
@kikosalguero You're getting the data back as it is returned from the API, so it won't always return in the same order as the users listed in your array.
greg
@wearenotgroot
@Morazajuan sure link your pen or fiddle