1 Replies - 1534 Views - Last Post: 24 June 2009 - 06:57 AM

#1 hrvoje89   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 63
  • Joined: 05-February 09

Don't fadeIn div if $.post (data) is not done

Posted 22 June 2009 - 04:56 PM

Hello all,

I am having problems with this code:

 $('a.linkdetalji').click(function() {
	var top = $(this).offset().top;
	var left = $(this).offset().left;
	var partnum = $(this).attr('href');  
 /// Problem start
 $.post("artikli-detalji.php", { varijabla: partnum }, function(data){
 ///Problem end

 $('#detalji').css({ 'top':top, 'left':left, 'position':'absolute' });
 return false;

  $('a#linkdetaljiclose').click(function() {
 return false;


The problem is that while i use append(data) the effects are slow (lagging).. when i remove whole $.post the effects are smooth...

Now i would like to do next thing...

i would like to make the div text say "loading" until whole $.post thing is done... ($.post is getting a lot of data,that is why its laggy)..

I hope you understand.. if not :) one more time...

I would like to get data from "artikli-detalji.php" and while i am getting data i want some text to say "loading..." then when i get all the data
i want to display the data in div... :)

Thank you for help!

Is This A Good Question/Topic? 0
  • +

Replies To: Don't fadeIn div if $.post (data) is not done

#2 xerxes333   User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 504
  • Joined: 05-July 07

Re: Don't fadeIn div if $.post (data) is not done

Posted 24 June 2009 - 06:57 AM

Have you tried using .ajax instead of .post? You have many more options available with .ajax. If not, I would try using the callback of .post to actually display the info. IE: when the user clicks, the initial thing loaded is a simple div with the "loading" text. Once the post is complete (callback) call another function that displays the data you with to post.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1