Div refresh and dialog link in that refresed div?
I'm not very good at English and olso not in JQuery, I'm more a phper.
I don't now if it's possible but i'm trying to make a monitor and i'm refreshing some content in a div element.
In that div i have a link/a to open a dialog. After the first refresh its not working anymore, to open the dialog.
Is it possible to do this or?
This is my test page:
- <!DOCTYPE html>
- <html>
-
- <head>
-
- <title>Monitor</title>
-
- <meta charset="UTF-8" />
-
- <!--<link rel="stylesheet" href="style.css" type="text/css" />-->
-
- <!-- Standaard JQuery -->
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
-
- <!-- JQuery DIV refresh -->
- <script type="text/javascript">
- $(document).ready(function () {
- setInterval(
- function () {
- $('#monitor').fadeOut("slow").html('<a id="btnok" href="#" title="Plaats of bewerk het bericht">Refresh link</a>').fadeIn("slow");
- }, 20000); // refresh every 30000 milliseconds
- $.ajaxSetup({ cache: false });
- });
- </script>
-
- <!-- JQuery UI -->
- <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
- <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
- <script>
- $(function() {
- $( "#dialog" ).dialog({
- autoOpen: false,
- show: {
- effect: "blind",
- duration: 1000
- },
- hide: {
- effect: "explode",
- duration: 1000
- }
- });
-
- $( "#btnok" ).click(function() {
- $( "#dialog" ).dialog( "open" );
- });
- });
- </script>
-
- </head>
- <body>
- <div id="dialog" title="Basic dialog">
- <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
- </div>
-
- <div id="monitor"><a id="btnok" href="#" title=" ">Refresh link</a></div>
-
- <a id="btnok" href="#" title=" ">Normal link</a>
-
- </body>
- </html>