[index.php] 파일
<script
src="https://code.jquery.com/jquery-3.1.1.js"
integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="
crossorigin="anonymous"></script>
<!-- <script src="https://code.jquery.com/jquery-1.10.2.js"></script> -->
<script type="text/javascript">
$(function(){
$("#tstButton").click(function(){
$.ajax({
type: 'GET',
url: 'part/nav_test.php?test=[-U U-]',
dataType : 'text',
error : function() {
alert('Fail!!');
},
success: function(data) {
$('#tstResult').html(data);
}
});
})
})
</script>
[Click me]버튼을 누르면 전체 화면을 불러오지 않고 대괄호 내부 값을 보여준다.
<input type="button" id="tstButton" value="Click me" /><br>
<H3 id="tstResult">[*******]</H3>
[nav_test.php] 파일
<?php
echo $_GET["test"]."<br>";
?>