2012-08-29 4 views

risposta

21

prova con

setTimeout(function(){ 
    $('#alert-success').slideUp('slow').fadeOut(function() { 
     window.location.reload(); 
     /* or window.location = window.location.href; */ 
    }); 
}, 5000); 
+0

È stato l'editing, ma tu mi hai battuto :) – Flash

+0

Grazie una tonnellata per una risposta rapida, Fabrizio è ora risolto. – Arish

2

Si potrebbe fare così: (quando si utilizza .slideUp, non v'è alcuna necessità di utilizzare .fadeOut)

setTimeout(function() { 
    $('#alert-success').slideUp('slow', window.location.reload); 
}, 5000); 
+0

Grazie xdazz lo terremo a mente. – Arish

1

Provalo sotto

<html> 
<head> 
<script type="text/JavaScript"> 
<!-- 
    function timedRefresh(timeoutPeriod) { 
    setTimeout("location.reload(true);",timeoutPeriod); 
} 
// --> 
</script> 
</head> 

<body onload="JavaScript:timedRefresh(5000);"> 
    <p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p> 
    <p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p> 
</body> 
</html> 
+0

Grazie per la risposta, ho già trovato la soluzione di Fabrizio :) – Arish

1

è anche possibile utilizzare

window.location.href = window.location.href 

Script riscritta come

setTimeout(function() 
{ 

    $('#alert-success').slideUp('slow').fadeOut(); 
    window.location.href = window.location.href 

},5000)