Files
sam-kd/estimate/test_ajax.html
hskwon aca1767eb9 초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
2025-12-10 20:14:31 +09:00

43 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>AJAX Test</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<h1>AJAX Test for fetch_length_data.php</h1>
<div>
<label>Length:</label>
<input type="text" id="testLength" value="1000" />
<button onclick="testAjax()">Test AJAX</button>
</div>
<div id="result"></div>
<script>
function testAjax() {
const length = $('#testLength').val();
$.ajax({
url: 'fetch_length_data.php',
type: 'POST',
data: {
length: parseFloat(length),
rowIndex: 0,
inputType: 'area_length'
},
dataType: 'json',
success: function(response) {
console.log('Success:', response);
$('#result').html('<pre>' + JSON.stringify(response, null, 2) + '</pre>');
},
error: function(xhr, status, error) {
console.error('Error:', {xhr, status, error});
$('#result').html('<p style="color: red;">Error: ' + error + '</p><pre>' + xhr.responseText + '</pre>');
}
});
}
</script>
</body>
</html>