첫 번째 Ajax 함수를 사용하여 두 번째 html select 요소를 생성하는 첫 번째 html select 요소가 있는데 제대로 작동합니다. 이 두 번째 html 요소는 세 번째 html select 요소를 생성하지만 세 번째 선택기 생성을 위해이 코드를 수행하면 작동하지 않습니다. 누구든지 나를 도울 수있게 만들었습니까? jquery를 사용하여 이전 선택된 값으로 html select 요소를 생성합니다.
$("#SystemNameSelection").on('change',function()
{
var SystemName = $("#SystemNameSelection").text();
if (SystemName === "Value1") {
$.ajax({
url:"MyFile1.php",
success:function(result) {
$("#MyElementToPutTheSelector").html(result);
}
});
}
else if (SystemName === "Value2") {
$.ajax({
url:"MyFile2.php",
success:function(result) {
$("#MyElementToPutTheSelector").html(result);
}
});
}
else if (SystemName === "Value3") {
$.ajax({
url:"MyFile3.php",
success:function(result) {
$("#MyElementToPutTheSelector").html(result);
}
});
}
});
Myfile1, myfile2가와 MyFile3
세 가지 HTML을 선택 요소를 포함 : 여기 는 코드입니다. .change() 메서드로 시도해 보았지만 작동하지 않았습니다.
당신은 아마 이것과 함께 몇 가지 html을 첨부해야합니다. 그리고 아마 jsFiddle. – MikeWu
브라우저 개발자 도구를 사용하고 네트워크 요청을 확인하십시오. 전송 된 내용과 AJAX 요청에 반환되는 내용을 볼 수 있어야합니다. 문제가있는 쪽을 알려줍니다. – StaticVoid
show html 충분하지 않습니다. –