K. D.
K. D.

Reputation: 4239

jQuery load finish-event not working?

i want to expand a division with data that should be loaded from another server.

the problem is if i start expanding the division (toggleslide) and the load method finishs the height is jumping and the effect is destroyed.

what i want is that jquery starts expanding AFTER the data-transfer finished but my following code does not work:

// divison name = details
details.load("index.php", expandLastResultDetails3(details));

function expandLastResultDetails3(details) {
    $(details).slideToggle('slow', function () {
        ready();
    });
}

the box is jumping because (i guess) the slidetoggle starts to early.

Upvotes: 1

Views: 341

Answers (1)

João Silva
João Silva

Reputation: 91349

.load() expects a function callback to be called upon the completion of the request. However, instead of passing a callback, you are executing the function. Try the following:

details.load("index.php", function () {
  expandLastResultDetails3(details);
});

Upvotes: 5

Related Questions