[jQuery] Two clicks to show a div...

[jQuery] Two clicks to show a div...


Hi... I have a little problem...
I'm using this code to load some ajax querys...
var LoadPhotosJQuery = {
load : function() {
var links = $(".box_link");
links.each( function(e) {
var elements = links[e].id.split('#')[1];
$(links[e]).click( function(ev) {
ev.preventDefault();
$.ajax({
type : 'get' ,
url : "ajaxfiles/file.php" ,
data : {orderBy:elements} ,
dataType : "html" ,
error : function(er)
{ alert(er); } ,
success : function(c) {
$('#'+elements).text(c);
$('#'+elements).slideToggle(200);
}
});
});
});
}
}
The problem is in $().slideToggle()... When I click some link, first
show very quick the ajax file and hide the div. After that, works
perfectly... i don't know why... But if I change the order of this
lines
$('#'+elements).text(c);
$('#'+elements).slideToggle(200);
To this
$('#'+elements).slideToggle(200);
$('#'+elements).text(c);
In the first click div doesn't show, but in the second click it does.
I don't know what to do.
I'll apprecite any help...
PD : Sorry for my english... if you need more info, just ask for it, I
will try to give it as clear as I can... thanks =)
See you =)