답변 5개 / 댓글 5개
<button type="button" onclick="ajax_latest('button_id1')">버튼1</button>
<button type="button" onclick="ajax_latest('button_id2')">버튼2</button>
<button type="button" onclick="ajax_latest('button_id3')">버튼3</button>
<button type="button" onclick="ajax_latest('button_id4')">버튼4</button>
<div id="blatest">
</div>
<script type="text/javascript">
<!--
functon ajax_latest(tableName){
$.ajax({
type: "GET",
url: g5_url +"/ajax_latest.php",
data:{"bo_table":"tableName"} ,
success: function(data) {
jQuery("#blatest").html(data);
}
});
}
//-->
</script>
....
ajax_latest.php (그누보드 루트에)
<?php
include_once('./_common.php');
echo latest('SKINNAME', $bo_table, 6, 24);
?>
답변에 대한 댓글 2개
아래로 사용하시면 됩니다
function ajax_latest(tableName){
$.ajax({
type: "GET",
url: g5_url +"/ajax_latest.php",
data:{"bo_table":tableName} ,
success: function(data) {
jQuery("#blatest").html(data);
}
});
}
ajax로 처리하셔도 되고요.
아니면 해당 페이지 처음부분에 자바스크립트로 해당 동작 하게 구현한뒤에
form submit해서 같은 페이지를 새로 로드해서 처리하는 방식도 가능합니다.
해당 부분은 onlymilk47님 처럼 ajax로 처리하셔야 할듯 합니다.
답변을 작성하려면 로그인이 필요합니다.
근데 ajax_latest.php를 못불러오네요...
어떤문제인지 모르겠습니다.
Uncaught ReferenceError: ajax_latest is not defined
at HTMLButtonElement.onclick