Interview Questions

How to Auto refresh DIV content in jsp?

Use the following code to auto refresh DIV content in jsp page.

<%@ taglib prefix="c"           uri="http://java.sun.com/jsp/jstl/core"  %>

<html>
<script language="javascript">
var delay = 10000;
var autoRefreshContent = setInterval(
                function ()
                {
                       
                                var url = "<c:url value='/tdd/content.htm'> </c:url>";
                                url = url +"?sId="+Math.random();
                         $('#contentDiv').load(url).fadeIn("slow");
                }, delay);
</script>
<body>
<div id="contentDiv" >
<%@ include file="content.jsp"%>
        </div>
</body>

</html>