Solved

preload until the content of a jquery dialog is loaded

Posted on 2014-07-22
1
492 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

828 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