Saturday, May 30, 2009

[jQuery] Help with simple function

Trying to click hide contents of div, show loading, hide loading and fade new contents in when loaded.
 
This works but does not have the loading effects
$('a.save_me').click(function() {
  $(this).fadeOut("slow");
      $('.job_save').load(
          $(this).attr('href'),
     function () {
        $(this).fadeIn("slow");
    });
    return false;
});
  
  
   This shows the loading effects then nothing happens
  
   $("a.save_me").click(function(){
 var id = $(this).attr('id');
 $(".job_save").fadeOut("fast", function(){
  $("#loading").show(function(){
   $(".job_save").load('/jobs/myjobs/' + id , function(){
    $("#loading").hide(function(){
     $(".job_save").fadeIn("fast");
     });
    });
   });
  });
 }); 
 
can someone point out to me the error?
 
Thanks
 
Dave

No comments: