$.ajax({ 에서 html 값을 밖으로 뺄려구 합니다 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

$.ajax({ 에서 html 값을 밖으로 뺄려구 합니다 정보

$.ajax({ 에서 html 값을 밖으로 뺄려구 합니다

본문


<script type="text/javascript">
var notification_ajax_result = 0;
function reloade()
{
	notification_ajax_result = 0;
	$.ajax({
		type: "GET",
		url: "<?=$g4[path]?>/notification/notification_function.php",
		data: "page="+notification_page,
		cache: false,
		success: function(html) {
			reloade_success(html);
		}
	});
}

function reloade_success(html) {
	notification_ajax_result = 0;
	if(html) {
		 notification_ajax_result = 1;
		$("#notification_view").html(html);
	} else
		 notification_ajax_result = 0;
}

function notification_next()
{
	notification_page += 1;
	reloade();
	 if(!notification_ajax_result)
		notification_page -= 1;
	 notification_ajax_result = 0;

}

function notification_back()
{
	notification_page -= 1;
	reloade();
	if(!notification_ajax_result)
		notification_page += 1;
	notification_ajax_result = 0;
}
</script>


이런식으로 짜봣는데 notification_ajax_result 가 정의되는게 if(!notification_ajax_result) 보다 늦어서 그런지 notification_page값을 원래대로 돌려버리네요 ;
기능은 받아온 html가 잇으면 새로 갱신하고 html가 없으면 올렷던 페이지번호를 다시 내리는..

댓글 전체

<script type="text/javascript">
function reloade(mode)
{
notification_page = notification_page+mode;
$.ajax({
type: "GET",
url: "<?=$g4[path]?>/notification/notification_function.php",
data: "page="+notification_page,
cache: false,
success: function(html) {
if(html)
$("#notification_view").html(html);
else
if(mode == -1)
notification_page += 1;
else if(mode == 1)
notification_page -= 1;
}
});
}
</script>
<span onclick="reloade(-1)" style='cursor:pointer'>&lt;</span><span>ㅁㅁㅁ</span><span onclick="reloade(1)"style='cursor:pointer'>&gt;</span>


이렇게 해결봣습니다 ^^;
전체 70 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT