JQuery generic dialog example part 1/2


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. $(function() {
  3. // dialog prepare function
  4. $.prepare_dialog = function() {
  5. $(document).find('body').append('<div id="generic_dialog"></div>');
  6. $('#generic_dialog').dialog({
  7. autoOpen: false,
  8. bgiframe: true,
  9. resizable: true,
  10. height:400,
  11. width: 800,
  12. modal: true,
  13. buttons: {
  14. 'Close': function(){
  15. $(this).dialog('close');
  16. }
  17. }
  18. });
  19. }
  20. // dialog content polling
  21. $.fetch_dialog_content = function() {
  22. $.ajax({
  23. type: 'POST',
  24. url: '{{$base_url_lang}}' + 'system/test/acl_editor_test/get_dialog_content',
  25. success: function(html_input){
  26. $('#generic_dialog').html(html_input);
  27. $('#generic_dialog').dialog('open');
  28. }
  29. });
  30. }
  31. // "click" event registration
  32. $('#open_first_editor').click(function(){
  33. $.fetch_dialog_content();
  34. });
  35.  
  36. // dialog preparation
  37. $.prepare_dialog();
  38.  
  39. });
  40. </script>
  41.  
  42. <div id="main_content">
  43. <a id="open_first_editor">Open First Dialog</a>
  44. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.