본문 바로가기
Programming/Web

Ajax를 이용한 화면 깜빡임없는 refresh 함수

by Chan_찬 2011. 3. 13.
728x90


function refreshPage(printID, pageUrl, delay, _method) { 
var update = new Ajax.PeriodicalUpdater(

 
{success: printID}, // 실행이 성공하여 정상적으로 결과가 반환 되었을 때
  decodeURIComponent(pageUrl), //refresh할 pgae를 uft8로 바꾼다, pageUrl+'?utf8=1'도 가능

  {

  method: _method, // GET/POST 방식으로 전송

    //parameters: ,

   
frequency: delay, // refresh되는 second
    decay: 1

    }

  );

}
 

refreshPage(info, data.html, 10, get) // id=info 인 곳에 data.html 를 읽어서 10초 주기로 refresh한다.

Ajax를 이용한 화면 깜빡임없는 refresh 함수
ajax javascript를 첨부해야 한다.

728x90
728x90
Buy me a coffeeBuy me a coffee

댓글