Solved

preload until the content of a jquery dialog is loaded

Posted on 2014-07-22
1
486 Views
Last Modified: 2014-07-23
I have this code :
<script type="text/javascript">
$(function() {
  $(".busqueda").click(function(){
  var element = $(this);
  var del_id = element.attr("id");
  var del_name = element.attr("name");

  function loadData(page,del_id,del_name){
     $.ajax
     ({type: "POST", url: "ajax2.php", data: { page: page, rID: del_id, tID: del_name, ancho: 768 },
       success: function(msg){
         $("#medios").bind('dialogopen').bind('dialogclose', function() {  $(this).dialog('destroy'); })
         .dialog({autoOpen: false, maxHeight: 0.95 * $(window).height(), width: 800, modal: false,
                  position: 'top', resizable: false, autoResize: true }).dialog('open');
	   
	     $(document).ajaxComplete(
	        function(event, request, settings)
		    { $("#tabla").html(msg); }); }
         });
       }
       loadData(1,del_id,del_name);  
       $(document).on("click",'.container .pagination1 li.active',function()
	   { var page = $(this).attr('p'); loadData(page,del_id,del_name);});           
  });
});		
</script>

Open in new window


It works without a problem, but I would like to know if it is possible to add it preload while the content of the "jquery dialog" is loaded?
0
Comment
Question by:altariamx2003
1 Comment
 

Accepted Solution

by:
altariamx2003 earned 0 total points
ID: 40213568
this is the solution
--------------------------------------------------------
                 function loading_show(){
                    $('#loading').html("<img src='../../imagenes/loading.gif'/>").fadeIn('fast');
                }
                function loading_hide(){
                    $('#loading').fadeOut('fast');
                }  
--------------------------------------------------------
     loading_show();
  $.ajax{

           $(document).ajaxComplete(
              function(event, request, settings)
                { loading_hide(); something}
         });}
--------------------------------------------------------
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now