JSON의 데이터를 ajax로 html로 추가하고 append를 사용하여 데이터를 처리하려고합니다. 하지만 외부 파일에서 html을로드하려고 할 때 문제가 발생합니다. 변수가 jquery load로 읽을 수 없습니다.JSON에서 데이터를 가져 오는 것이 jquery load와 함께 작동하지 않습니다
jquery로 외부 파일에서 변수를 읽어 HTML로 표시하려면 어떻게해야합니까?
$.ajax({
url:'person.json',
dataType:'json',
type:'get',
cache: false,
success:function(data){
$(data.person).each(function(index, value){
//$("#loadJson").append('<p><strong>Name : </strong>'+value.first_name+'</br><strong>Company: </strong>'+value.company+'</br> <strong>Email: </strong>'+value.email+' </p>')
$("#loadJson").load('data.html');
})
}
})
<p><strong>Name: </strong>'+value.first_name+'</br><strong>Company: </strong>'+value.company+'</br> <strong>Email: </strong>'+value.email+' </p>
내가 확신 경로 –