calling php function in javascript refresh

前端 未结 2 602
慢半拍i
慢半拍i 2021-01-26 09:34

I have this simple function in javascript to refresh a page after a set time.

function AutoRefresh( t ) {
    setTimeout(\"location.reload(true);\", t);
}
         


        
2条回答
  •  悲&欢浪女
    2021-01-26 10:32

    I'm afraid the answer is no. By the time JavaScript has been run on your page, the server side (PHP) has already finished processing. Your best bet is to accomplish what you need before the page load, or accomplish it with JavaScript alone.

提交回复
热议问题