아래 코드를 찾으십시오. 제 문제는 내부 jQuery.get()이 실행되지 않는다는 것입니다. 어떤 사람이 나를 도와 줄 수 있습니까? 정말 어떤 포인터를 감사하겠습니다 중첩 된 jquery 함수에 대한 도움이 필요합니다.
<div id="contact_form">
<form name="contact" action="">
<fieldset>
<label for="name" id="name_label">Name</label>
<input type="text" name="name" id="name" size="30" value="" class="text-input" />
<label class="error" for="name" id="name_error">This field is required.</label>
<br />
<input type="submit" name="submit" class="button" id="submit_btn" value="Send" />
</fieldset>
</form>
</div>
처럼
jQuery(document).ready(function() {
$('.error').hide();
$(".button").click(function() {
// validate and process form here
$('.error').hide();
var zipCode = $("input#name").val();
if (zipCode == "") {
$("label#name_error").show();
$("input#name").focus();
return false;
}
var key = 'ac9c073a8e025308101307';
var noOfDays = 5;
var url = 'http://www.worldweatheronline.com/feed/weather.ashx?q=' + zipCode + '&format=json&num_of_days=' + noOfDays + '&key=' + key;
alert(url);
jQuery.get(url, function(test) {
alert(url);
$.each(test.data.weather, function(i, item){
$("body").append("<p>Date: "+item.date+"</p>");
if (i == 3) return false;
}); }, 'jsonp')();
});
});
내 HTML 양식을 보인다.
감사합니다.
당신은 그것에서 실행되지 않는 의미를 모든? 'error()'콜백을 추가 할 수 있습니까? 나는 서비스가'success' 콜백을 유발하지 않는 에러를 반환한다고 가정 할 것이다. –
경고가 실행됩니까? – spinon
jQuery.get이 전혀 실행되지 않습니다. 함수 내부의 경고가 작동하지 않기 때문에이 사실을 알고 있습니다. 외부 알림은 수행하지만 내부 알림은 수행하지 않습니다. –