$.ajax({ 에서 html 값을 밖으로 뺄려구 합니다
[code]
<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>
[/code]
이런식으로 짜봣는데 notification_ajax_result 가 정의되는게 if(!notification_ajax_result) 보다 늦어서 그런지 notification_page값을 원래대로 돌려버리네요 ;
기능은 받아온 html가 잇으면 새로 갱신하고 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>
[/code]
이런식으로 짜봣는데 notification_ajax_result 가 정의되는게 if(!notification_ajax_result) 보다 늦어서 그런지 notification_page값을 원래대로 돌려버리네요 ;
기능은 받아온 html가 잇으면 새로 갱신하고 html가 없으면 올렷던 페이지번호를 다시 내리는..
댓글 2개
새로운나라
14년 전
18 32 42 라인이 별 의미 없는것 같군요
14년 전
<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'><</span><span>ㅁㅁㅁ</span><span onclick="reloade(1)"style='cursor:pointer'>></span>
이렇게 해결봣습니다 ^^;
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'><</span><span>ㅁㅁㅁ</span><span onclick="reloade(1)"style='cursor:pointer'>></span>
이렇게 해결봣습니다 ^^;
게시판 목록
그누4 질문답변
그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.
기존 게시물은 열람만 가능합니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 66514 | 11년 전 | 2127 | ||
| 66513 | 11년 전 | 4476 | ||
| 66512 | 11년 전 | 4140 | ||
| 66511 | 11년 전 | 2409 | ||
| 66510 | 11년 전 | 3022 | ||
| 66509 |
반갑습니다요
|
11년 전 | 2885 | |
| 66508 |
|
11년 전 | 3474 | |
| 66507 |
자동차방향제
|
11년 전 | 2931 | |
| 66506 |
구라대마왕
|
11년 전 | 2703 | |
| 66505 | 11년 전 | 2780 | ||
| 66504 | 11년 전 | 3110 | ||
| 66503 |
착한아이민이
|
11년 전 | 3296 | |
| 66502 | 11년 전 | 2712 | ||
| 66501 |
착한아이민이
|
11년 전 | 2560 | |
| 66500 |
canth
|
11년 전 | 3289 | |
| 66499 |
한번잘해보자
|
11년 전 | 4226 | |
| 66498 | 11년 전 | 2859 | ||
| 66497 |
xargs
|
11년 전 | 2545 | |
| 66496 |
aisru
|
11년 전 | 2630 | |
| 66495 |
alexseo
|
11년 전 | 2732 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기