Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <%@page pageEncoding="UTF-8" %>
- <script type="text/javascript">
- var data = null;
- <c:if test="${dataC != null}">
- // Note: DO NOT INCLUDE jsonMsg.jsp TWICE!!!
- data = JSON.stringify(${dataC});
- </c:if>
- $(document).ready(function() {
- if (data != null)
- {
- // Parsing JSON object:
- data = $.parseJSON(data);
- // In case URL is forwarded, we will do a redirect
- if (data[0].url != null)
- {
- setTimeout(function() {
- window.location.href = data[0].url;
- }, 5000); // is k, 5sec
- }
- // msgType is used for div class (alert-success | alert-danger)
- if (data[0].msgType != null)
- {
- $("#jsonMsg").addClass(data[0].msgType);
- }
- // Message:
- if (data[0].message != null)
- {
- $("#jsonMsg").append(data[0].message);
- }
- }
- });
- </script>
- <c:if test="${dataC != null}">
- <div id="jsonMsg" class="alert">
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
- </div>
- </c:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement