0
아약스 URL을 변수 도형으로 설정하려고합니다.변수를 ajax url로 설정하십시오.
가변 res는 다른 문자열의 조합입니다. 코드를 살펴볼 수 있습니다.
<form id="frm1">
<input type="text" name="fname" value="" placeholder="Update Location">
</form>
<button class="btn btn-default pull-right" onclick="loadWeather()"type="button">
Search
</button>
HTML은 여기 양식의 텍스트를 가져 오기 위해 노력하고있어.
의 .js
window.onload = loadWeather();
var part = "http://api.openweathermap.org/data/2.5/weather?q=";
var a = encodeURI(part);
var b = document.getElementById("frm1");
var text = b.elements[0].value;
var urll = "&units=metric&appid=MYKEY";
var c = encodeURI(urll);
var res = a + text + c;
function loadWeather() {
$.ajax({
url: res,
I 그것이 정의로서 도시 콘솔에서 입술의 값을 확인
.하나 이상의 오류 blog.js에 널 (null) 의 특성 '요소'를 읽을 수 없습니다입니다 : 7
내가 원하는 모든 최종 URL이 this-
http://api.openweathermap.org/data/2.5/weather?q=FORMDATA&units=metric&appid=MYKEY
같은 동일해야한다는 것입니다