jQuery Ajax를 통해 PHP 파일에서 정보를 받고 아래와 같이 정보를 반복합니다. a를 호출하고 부트 스트랩이 제공 <tr class="active">
하는 <tr><td>
형식에 넣을 필요가 있습니다 . 그러나 불행히도 이것은 일어나지 않습니다.
누구에게 제안이 있습니까? 감사합니다 :)
function getStudentList() {
$.ajax({ //create an ajax request to load_page.php
type: "GET",
url: "getView.php",
dataType: "json", //expect html to be returned
success: function(response){
$.each(response, function(index, response){
$( "#aaa" ).append('<tr class="active"><td>' + response['Student_ID'] + '</td><td>' + response['FirstName'] + "</td><td>" + response['LastName'] + "</td><td>" + response['Student_ID'] + "</td><td>" + response['Year'] + '</td></tr>');
});
},
error: function(e) {
//called when there is an error
console.log("Error: " + e.message);
}
});
}
---------- HEADER.PHP ---------------
<!-- Database Config Files -->
<?php include('db_config.php'); ?>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Custom css -->
<link rel="stylesheet" type="text/css" href="style.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="export.js"></script>
<script type="text/javascript" src="contact.js"></script>
<script type="text/javascript" src="view.js"></script>
<script type="text/javascript" src="create.js"></script>
<script type="text/javascript" src="edit.js"></script>
<script type="text/javascript" src="delete.js"></script>
<script type="text/javascript" src="search.js"></script>
더 나은 IDE를 사용하는 것이 좋습니다. PHPStorm을 추천합니다. 문제는 따옴표가있는 구문 인 것 같습니다. 다음 영역을 확인하십시오.
당신은 :
<td>' + response['Student_ID'] + '</td>
해야한다:
<td>' + response["Student_ID"] + '</td>
더 나은 방법 :
<td>' + response.Student_ID + '</td>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다