AJAX 호출을 줄임 #3

This commit is contained in:
YJSoft 2016-01-15 00:18:51 +09:00
parent c2d9973cb3
commit 11d8876733

View file

@ -133,9 +133,16 @@ function deleteItem(poll_srl,poll_srl_indexes,poll_item_srl) {
return false; return false;
} }
function loadPoll(poll_srl) function loadPoll(poll_srl,data)
{ {
jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){ if(typeof data == 'undefined')
{
jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){
loadPoll(parseInt(data.poll.poll_srl),data);
}
}
else
{
jQuery("#stop_date_"+poll_srl).html(data.poll.stop_date); jQuery("#stop_date_"+poll_srl).html(data.poll.stop_date);
initTemplete('poll'); initTemplete('poll');
@ -164,7 +171,7 @@ function loadPoll(poll_srl)
jQuery("#poll_" + poll_srl + '_result').css({ jQuery("#poll_" + poll_srl + '_result').css({
display: "none" display: "none"
}); });
}); }
} }
function showPollMemberNext(poll_srl,poll_item_srl) function showPollMemberNext(poll_srl,poll_item_srl)
@ -256,15 +263,14 @@ function showPollMember(poll_srl,poll_item_srl)
function loadPollResult(poll_srl) function loadPollResult(poll_srl)
{ {
jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){ if(typeof data == 'undefined')
/* {
<block cond="$val->poll_count"> jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){
{@$per = (int)(( $item->poll_count / $val->poll_count)*100) } loadPollResult(parseInt(data.poll.poll_srl),data);
</block> }
<block cond="!$val->poll_count"> }
{@$per = 0} else
</block> {
*/
jQuery("#stop_date_result_" + poll_srl).html(data.poll.stop_date); jQuery("#stop_date_result_" + poll_srl).html(data.poll.stop_date);
jQuery("#poll_count_result_" + poll_srl).html(data.poll.poll_count); jQuery("#poll_count_result_" + poll_srl).html(data.poll.poll_count);
@ -311,13 +317,7 @@ function loadPollResult(poll_srl)
jQuery("#poll_" + poll_srl + '_result').css({ jQuery("#poll_" + poll_srl + '_result').css({
display: "block" display: "block"
}); });
/* }
<!--@foreach($poll->poll as $poll_srl_index => $val)-->
<!--@foreach($val->item as $item_srl => $item)-->
<!--@end-->
<!--@end-->
*/
});
} }
jQuery(function($){ jQuery(function($){
@ -401,4 +401,4 @@ jQuery(function($){
return false; return false;
}); });
}); });