0
AJAX 호출 정보가 포함 된 div 내부 정보를 새로 고치고 업데이트하는 방법에 대한 지침이 필요합니다. 현재 div는 클릭시 업데이트하기 전에 비 웁니다. 클릭 이벤트 처리기에 바인딩하지 않고이 작업이 필요합니다.AJAX를 사용하여 jquery 새로 고침 및 표시
var selectedSize = "Select a Size";
$("#ResidentialBuildingSize").append('<option value="' + selectedSize + '">' + selectedSize + '</option>');
$('option[value="' + selectedSize + '"]').attr('disabled', 'disabled');
$("#ResidentialBuildingStories").change(function() {
url = '/ResidentialBuilding/getBldgSize?stories=';
optionElement = $('#ResidentialBuildingStories').val();
url = url + optionElement;
$("#ResidentialBuildingSize").empty();
$("#ResidentialBuildingSize").append('<option value="' + selectedSize + '">' + selectedSize + '</option>');
$('option[value="' + selectedSize + '"]').attr('disabled', 'disabled');
$.getJSON(url, function (data) {
$.each(data, function (index, value) {
$('#ResidentialBuildingSize').append('<option value"' + value.size + '">' + value.size + '</option>');
});
});
$("#info").click(function() {
infoHead = "infoHead";
invisible = "invisible";
type = $("#ResidentialBuildingType").val();
stories = $("#ResidentialBuildingStories").val();
size = $("#ResidentialBuildingSize").val();
url = "/ResidentialBuilding/getBldgInfo?type=" + type + "&stories=" + stories + "&size=" + size;
//$("#titles").empty();
//$("#values").empty();
$.getJSON(url, function (data) {
$.each(data, function (index, value) {
$("#titles").empty();
$("#values").empty();
$("#titles").append('<h5 class="' + infoHead + '">' + value.r.type + " (" + value.r.stories + ")" + '</h5>');
$("#titles").append('<p>' + "Stories" + '</p>');
$("#titles").append('<p>' + "Age" + '</p>');
$("#titles").append('<p>' + "Size" + '</p>');
$("#titles").append('<p>' + "Orientation" + '</p>');
$("#titles").append('<p>' + "Shape" + '</p>');
$("#titles").append('<p>' + "Floor Height" + '</p>');
$("#titles").append('<p>' + "Foundation" + '</p>');
$("#titles").append('<p>' + "Window Percent" + '</p>');
$("#titles").append('<p>' + "Heating" + '</p>');
$("#titles").append('<p>' + "Cooling" + '</p>');
$("#values").append('<h5 class="' + infoHead + ' ' + invisible + '">' + ' ' + '</h5>');
$("#values").append('<p>' + value.r.stories + '</p>');
$("#values").append('<p>' + value.r.age + '</p>');
});
});
});
});//end change function
감사를 사용해보십시오 :
여기에 코드입니다. jQuerys .change() 기능을 사용하여이 문제를 해결할 수있었습니다. –