I want to pull from the form the city name. and place it in the var at top where it say dallas so that when some one enters the city name it will auto update the var with right city name. I apologize for the early long winded remark. Stack overflow wanted more.
Turn HTML Form Input into JavaScript Variable
and
Obtain form input fields using jQuery?
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css"></style>
<script type="text/javascript" rel="script" type="script" href="script.jss"></script>
<script type="text/javascript" src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
<script type="text/javascript">
$(document).ready(function() {
// $("#submit").click(function(){
// alert("The paragraph was clicked.");
// }); // Submit button click
var city = "dallas" <==== code to pull from form
console.log(city);
$.get("http://api.openweathermap.org/data/2.5/weather?q="+ city + "&&units=imperial&APPID=46468f48fc0759e3d79e69e4127838da" //api call with imperial units
,function(data){
console.log(data);
$("#weather").append(data.name); // City name
$("#temp").append(data.main.temp) //temp pull
});
});
</script>
</head>
<body>
<div id='wrapper'>
<div id = "formdiv">
<form id= "forminfo">
<input type="text" name="city" value="cityname" > <---this
<input id = "submit" type="submit" ></input>
</form>
</div>
<div id = 'weather'> </div>
<div id='temp'> <p></p> </div>
</body>
</html>