Skip to content

Mi code#12

Open
karla-moreno wants to merge 8 commits intowdi-atx-12:masterfrom
karla-moreno:miCode
Open

Mi code#12
karla-moreno wants to merge 8 commits intowdi-atx-12:masterfrom
karla-moreno:miCode

Conversation

@karla-moreno
Copy link

Karla Moreno submitting weather-app assignment
...most definitely should've given myself more time to do this assignment

index.html Outdated
<meta charset="utf-8">
<title>Mini Weather App</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css" integrity="sha256-HxaKz5E/eBbvhGMNwhWRPrAR9i/lG1JeT4mD6hCQ7s4=" crossorigin="anonymous" />
<link rel="stylesheet" href="css/style.css">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure your custom CSS is the last file loaded (bootstrap , normalize, googlefont) should all be first.

$(document).ready(function(){
console.log('ready');

//I DONT KNOW WHAT TO DO TO MAKE MY WEBSITE DELETE OLD STUFF ON ENTRY!!!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try to just clear out the text in those inputs by setting it to an empty string $(input).text('').

Copy link
Author

@karla-moreno karla-moreno Sep 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that worked; thank you. i tried my .remove() functions again, and apparently they work now 😄

edit: i lied, something is wrong with them.. i'll try both in the future.

$.ajax({
method: 'GET',
url: 'http://api.openweathermap.org/data/2.5/weather',
data: $('form').serialize() + '&units=imperial&appid=a77765c844f61df44fe43412c991b9cf',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are serializing the form, you can also add two hidden inputs for appid and units to the form to be included instead of writing them out by hand here.

var temp = parseFloat(data.main.temp);
console.log(temp);
$('.temperature-container').css('visibility', 'visible');
$('.temperature').append(temp + String.fromCharCode(176) + "F");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!! This would be a good spot to have a comment to let others know what the code is for.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the styling, temperature format when append'ed to html, or both?


// error 403 forbidden for img :'(
function displayCityAndIcon(data){
var cityName = String(data.name);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it's unnecessary since the data.name returned is already a string.

…y jo; safety commit, progress to be made... over and out
…on changing based on actual weather description), needs work on rwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants