Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
SuckerPunched
Dec 20, 2006

Supervillin posted:

Haven't looked at jQuery's source in a while so I'm not sure how they implement getting that path (since obviously it's JS, not CSS), but that might be why IE6 barfs.

I'm 95% sure I've used the ">" selector with jQuery before and it works in IE6. I haven't tried in a while but I believe that jQuery handles it for you.

Adbot
ADBOT LOVES YOU

withoutclass
Nov 6, 2007

Resist the siren call of rhinocerosness

College Slice

SuckerPunched posted:

I have a pretty strong hunch that Firefox is the broken one in this case, allowing you to hide <option> tags.

The correct/better way is to remove/add the items that are unavailable, and add them back in when a valid selection is made.

I've used and like this plugin for easier selectbox manipulation: http://www.texotela.co.uk/code/jquery/select/

Thank you I will give this a whirl.

Supervillin posted:

Adding/removing items is the "right" way, like SuckerPunched said, but also IE6 doesn't recognize the child selector ">" in CSS. Haven't looked at jQuery's source in a while so I'm not sure how they implement getting that path (since obviously it's JS, not CSS), but that might be why IE6 barfs.

IE6 has no problem with that selector when trying to select a child that has a class or id associated with it, since I do this in other parts of the application and it works fine.

Sylink
Apr 17, 2004

Withdrawn, found error.

Sylink fucked around with this message at 22:05 on Apr 1, 2009

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Sylink posted:

This is a general javascript questions.

Perhaps you will have better luck posting in the general javascript questions thread:

http://forums.somethingawful.com/showthread.php?threadid=3070034

Sylink
Apr 17, 2004

Oh I saw a post about people asking javascript questions in here. Ill check that out too, I found the problem anyways.

Zorilla
Mar 23, 2005

GOING APE SPIT

Supervillin posted:

Adding/removing items is the "right" way, like SuckerPunched said, but also IE6 doesn't recognize the child selector ">" in CSS. Haven't looked at jQuery's source in a while so I'm not sure how they implement getting that path (since obviously it's JS, not CSS), but that might be why IE6 barfs.
jQuery's selection rules are completely separate from IE's limited support of CSS. I don't think I've ever had any issues that were specific to IE6 when using the ">" selector or any of the obscure pseudoclasses in jQuery like :first or :checked.

edit: slightly beaten, but none of the previous replies shared the same details

Sylink
Apr 17, 2004

I'm using the Jquery UI for some resizable elements. Is there way to retrieve the height/width values of the new box size?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Sylink posted:

I'm using the Jquery UI for some resizable elements. Is there way to retrieve the height/width values of the new box size?

http://docs.jquery.com/CSS

Sylink
Apr 17, 2004

Is it possible to animate repositioning of elements with jquery?

Currently trying this,

code:
  $(document).ready(function(){
    
	
	
 
    $("#imageleft").click(function(){
      $("#imageleft").animate({ 
        left: "-1000px",
        opacity: 0.4,
        fontSize: "3em", 
        borderWidth: "10px"
      }, 1500 );
    });

	
	 
  });

But the position part isn't occurring , even if I add position:absolute it does not work.

Zorilla
Mar 23, 2005

GOING APE SPIT

Sylink posted:

But the position part isn't occurring , even if I add position:absolute it does not work.

Are you using position: relative in the parent element?

Sylink
Apr 17, 2004

No would that affect it?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Sylink posted:

No would that affect it?

Yes. You have to have the parent element explicitly set to position:relative

ATLbeer
Sep 26, 2004
Über nerd
So... This is going to be a stupid question

I have a list of username's that I need to fetch via JSON and populate a select box but, I'll need to populate more select boxes with the same data (basically adding users to a list, press + button get new select box populated with users) so I'd like to avoid making the HTTP fetch every time the + button is pressed

Essentially I'd like to store the JSON data in a variable and reuse it over it over.

What I can't figure out is how to do essentially (which I know is wrong)
code:
list_users = $.getJSON("/ajax/data/listusers/");
The reason why I don't think I can use the normal $.getJSON("url", function(data){do stuff here}); pattern is that I can't seem to get data back OUT of the function(data) space. Is the proper pattern to create an object and pass it as a parameter to be manipulated in the function?

Zorilla
Mar 23, 2005

GOING APE SPIT

ATLbeer posted:

The reason why I don't think I can use the normal $.getJSON("url", function(data){do stuff here}); pattern is that I can't seem to get data back OUT of the function(data) space. Is the proper pattern to create an object and pass it as a parameter to be manipulated in the function?

Looking at the documentation, you'd probably have to do it this way:

code:
var list_users;

$.getJSON("/ajax/data/listusers/", function(data) {
	list_users = data;
});

Zorilla fucked around with this message at 19:14 on Apr 13, 2009

ATLbeer
Sep 26, 2004
Über nerd

Zorilla posted:

Looking at the documentation, you'd probably have to do it this way:

code:
var list_users;

$.getJSON("/ajax/data/listusers/", function(data) {
	list_users = data;
});

code:
var user_list;
        $.getJSON("/ajax/data/listusers/", function(data){
            user_list = data;
        });
        console.log(user_list);
FireBug logs out at console "undefined" for user_list

That URI returns this data
code:
[{"username": "test"}]

Zorilla
Mar 23, 2005

GOING APE SPIT

ATLbeer posted:

FireBug logs out at console "undefined" for user_list

That URI returns this data
code:
[{"username": "test"}]

What happens when you do console.log(user_list) from inside the function? Or with the data variable?

Here is another idea:
code:
list_users = $.ajax({
	url: "/ajax/data/listusers/",
	dataType: "json"
}).responseText;

ATLbeer
Sep 26, 2004
Über nerd

Zorilla posted:

What happens when you do console.log(user_list) from inside the function? Or with the data variable?

Here is another idea:
code:
list_users = $.ajax({
	url: "/ajax/data/listusers/",
	dataType: "json"
}).responseText;

code:
var user_list = "dummydata";
        $.getJSON("/ajax/data/listusers/", function(data){
            console.log(user_list)
            user_list = data;
        });
        console.log(user_list);
log as follows:
dummydata
dummydata


second version
code:
list_users = $.ajax({
                url: "/ajax/data/listusers/",
            	dataType: "json"
            }).responseText;
        console.log(list_users+"!");
        
second version console output


GET http://hqiq/ajax/data/listusers/ 200 OK 48ms jquery.min.js (line 19)
[{"username": "test"}]
----------------------------------------
!



I hate javascript :suicide:


vvv The dashes were added by me as a separator between showing the AJAX call to the JSON URI actually worked and the data it returned and then the console.log

ATLbeer fucked around with this message at 19:34 on Apr 13, 2009

Zorilla
Mar 23, 2005

GOING APE SPIT
Looks like the second idea is getting somewhere. What's with the dashes, is that part of the AJAX response displayed when doing console.log()? Hopefully, $.ajax().responseText isn't just limited to strings or else that is what's wrong with that example.

edit: or you probably also need to use async: false, otherwise the function just finishes immediately with no return value.

Zorilla fucked around with this message at 19:38 on Apr 13, 2009

Nigglypuff
Nov 9, 2006


BUY ME BONESTORM
OR
GO TO HELL
$.getJSON is asynchronous, so it returns immediately, but the function that you pass as the second parameter will not be called until the HTTP response actually arrives. Try this:
code:
        var user_list = "dummydata";
        $.getJSON("/ajax/data/listusers/", function(data){
            user_list = data;
           console.log('inside block...' + user_list)
        });
        console.log('outside block...' + user_list);

ATLbeer
Sep 26, 2004
Über nerd

Nigglypuff posted:

$.getJSON is asynchronous, so it returns immediately, but the function that you pass as the second parameter will not be called until the HTTP response actually arrives. Try this:
code:
        var user_list = "dummydata";
        $.getJSON("/ajax/data/listusers/", function(data){
            user_list = data;
           console.log('inside block...' + user_list)
        });
        console.log('outside block...' + user_list);

code:
outside block...dummydata
inside block...[object Object]
Well, that worked... Blargggg




Woah... When I comment out in the inner block console.log .... It doesn't work!

code:
var user_list = "dummydata";
        $.getJSON("/ajax/data/listusers/", function(data){
            user_list = data;
            console.log('inside block...' + user_list)
        });
        console.log('outside block...' + user_list);
outside block...dummydata
inside block...[object Object]

code:
var user_list = "dummydata";
        $.getJSON("/ajax/data/listusers/", function(data){
            user_list = data;
            //console.log('inside block...' + user_list)
        });
        console.log('outside block...' + user_list);

outside block...dummydata


:suicide:

ATLbeer fucked around with this message at 19:41 on Apr 13, 2009

Zorilla
Mar 23, 2005

GOING APE SPIT
The line that says "inside block" is no longer there after you commented it out. That seems normal to me. The reason they appear in backwards order is because $.getJSON() finishes immediately while the function(data) callback may take 1-2 seconds to run, as it has to wait for the HTTP request to finish. As a result, the second console.log() runs first.

That brings up another thing: when you do console.log('outside block...' + user_list);, the callback hasn't run yet, which means user_list hasn't yet gotten a chance to be assigned the data. That would be why the resulting value is still "dummydata" at that point. Try this:
code:
var user_list = "dummydata";

$.getJSON("/ajax/data/listusers/", function(data){
	user_list = data;
	fart();
});
console.log('outside block...' + user_list);

function fart()
	console.log('inside block...' + user_list);
}
It's not really any different than the previous examples, but it would demonstrate that variable scope is working the way it should

Zorilla fucked around with this message at 19:52 on Apr 13, 2009

ATLbeer
Sep 26, 2004
Über nerd
Yeah, figured out that getJSON is an async call

I dropped the getJSON code in the (document).ready block, declared the user_list in the global namespace and left the rest of the logic in the action call for the button press

Since user_list is populated on page load and the action us called on user press. I can't 100.00% guarantee the user_list variable will be populated by the time the button is pressed but, it almost always will be for all real-world cases

It might fail an automated unit test though.

Zorilla
Mar 23, 2005

GOING APE SPIT

ATLbeer posted:

Yeah, figured out that getJSON is an async call

I dropped the getJSON code in the (document).ready block, declared the user_list in the global namespace and left the rest of the logic in the action call for the button press

Since user_list is populated on page load and the action us called on user press. I can't 100.00% guarantee the user_list variable will be populated by the time the button is pressed but, it almost always will be for all real-world cases

It might fail an automated unit test though.

Yeah, that's why I think you should do this synchronously:
code:
list_users = $.ajax({
	url: "/ajax/data/listusers/",
	dataType: "json",
	async: false // Forgot this before. It should now wait until the HTTP tranaction is over for the function to finish
}).responseText;
Also, if the goal is just to duplicate a select box, is there anything keeping you from doing this?
code:
$('.somebutton').click(function() {
	$('select.users').after(this.html());
});

Zorilla fucked around with this message at 20:04 on Apr 13, 2009

Nigglypuff
Nov 9, 2006


BUY ME BONESTORM
OR
GO TO HELL
If the button gets clicked before the user_list variable is populated, you could set up a timer to wait until the data arrives and *then* populate the list. Something like this maybe?
code:

function handleButtonClick() {
    if (typeof user_data !== 'object') {
        setTimeout(arguments.callee, 100);
    } else {
        populateSelectBox(user_data);
    }
};

$('#the_button').click(handleButtonClick);

ATLbeer
Sep 26, 2004
Über nerd

Zorilla posted:

Yeah, that's why I think you should do this synchronously:
code:
list_users = $.ajax({
	url: "/ajax/data/listusers/",
	dataType: "json",
	async: false // Forgot this before. 
}).responseText;
Also, if the goal is just to duplicate a select box, is there anything keeping you from doing this?
code:
$('.somebutton').click(function() {
	$('select.users').after(this.html());
});

The "async: false" worked perfectly.. Much cleaner implemntation than spreading it around into different files.

I'm working on someone else's javascript and HTML wireframe and wiring up to a Django backend. They have a lot of code already to construct and add a custom select drop down that works great. They just had the populated the select box in one of the inner functions with some default "lorum ipsom" data not pulling it from the web service. I just needed to fix that bit.

Thanks for all the help.

MrData
Jun 28, 2008
Help me out here Goons.

code:
$(parsedJSON.sequences).each(function() {
   id = $(this).attr("id");			
   var div = $("<div>" + $(this).attr("name") + "&nbsp;</div>");
   var input = $("<input type='hidden' name='sequence_id[]' value='"+id+"'/>");
   var a = $("<a>CLICK ME</a>").attr('href','#').click(function() {		
     alert(id);
   });
 $(div).append(a).append(input);
 $("#sequences").append(div);
});
parsedJSON.sequences is a JSON array that contains objects with 'id' and 'name' attributes, and I loop through them using 'each'. The goal is to create div for each object in this collection. Now I create a bunch of DOM elements, among which an A-tag. I want to do something with the current id on-click of this A So if I have 3 objects in the sequence with id's 1,2 and 3 and I click the second A, it should alert 2. What happens now is that every click gives me the id of the last object in the sequence.

I'm obviously missing something here. First I thought that the click function cannot know about anything defined outside its scope, but I'm puzzled as to why it would know about the last id in the sequence. It's as if all the A's point to the same anonymous function. Now I can probably get it to work by using $(this) in the A-tag and using that as a start to fetch the hidden input and get its value, but I'd rather do it properly. I also took a look at the 'bind' method that yielded the same result. Thanks!

Zorilla
Mar 23, 2005

GOING APE SPIT

MrData posted:


You're handling parsedJSON.sequences like it's a jQuery selection instead of a plain old JSON object. How are you assigning that variable its value? Is it just a JSON object like [{"id": "stuff", "name": "junk"}] or is it created by doing something like parsedJSON.sequences = $('div.selectme'); ?

If parsedJSON.sequences is just a basic JSON object, maybe something like this would work?
code:
jQuery.each(parsedJSON.sequences, function() {
	var id = this.id;
	var name = this.name;
	
	var div =
		'<div name="'+name+'">'+
		'	<input type="hidden" name="sequence_id[]" value="'+id+'"/>'+
		'	<a href="#">CLICK ME</a>'+
		'</div>';
	
	$('#sequences').append(div);
	
	$('div[name="'+name+'"] a').click(function() {		
		alert(id);
	});
});

Zorilla fucked around with this message at 23:53 on Apr 14, 2009

MrData
Jun 28, 2008

Zorilla posted:

You're handling parsedJSON.sequences like it's a jQuery selection instead of a plain old JSON object. How are you assigning that variable its value? Is it just a JSON object like [{"id": "stuff", "name": "junk"}] or is it something created by doing something like parsedJSON.sequences = $('div.selectme'); ?

There also may be a bunch of things in that code that may indicate a misunderstanding of how jQuery works, but I'm not ready to conclude that yet.

parsedJSON.sequences is a plain old JSON object, that contains multiple sub-objects (like the example you posted) that I want to iterate over. I haven't posted the line of code that converts the JSON string I get back from my PHP call to an object, but I didn't think that would be relevant. I've seen in a number of blog posts that you can use jQuery to iterate over JSON object arrays using .each(), and I guess that part works fine for me. Within the .each() loop, I can use $(this).attr("id") to get the id-attribute of the current object in the loop.

I would very much welcome any pointers you could give (as to general jQuery misunderstandings or this particular issue).

Zorilla
Mar 23, 2005

GOING APE SPIT
Ok, I've been repeatedly updating my previous post to provide an example that I think might work. I can't test it though, so it may still need adjustments.

Probably the biggest thing to keep note of in my example is the difference between jQuery.each and Core/each. I switched to using the former because it's a generic iterator meant to handle objects and arrays. You were using Core/each before, and that's designed to use jQuery selections like $('div.selectme');.

Zorilla fucked around with this message at 23:25 on Apr 14, 2009

MrData
Jun 28, 2008

Zorilla posted:

Ok, I've been repeatedly updating my previous post to provide an example that I think might work. I can't test it though, so it may still need adjustments.

Probably the biggest thing to keep note of in my example is the difference between jQuery.each and Core/each. I switched to using the former because it's a generic iterator meant to handle objects and arrays. You were using Core/each before, and that's designed to use jQuery selections like $('div.selectme');.

Thanks for the clarification, I will read up on the difference. Just tried out the code you posted, but it's still pretty much the same effect.

code:
alert(id);
wasn't working so I changed that to:
code:
alert(this.id);
but that had no effect. I just get a blank alert message.

I seems that the anonymous method that's assigned to the a-tag click event has no idea what 'this' is, and so it can't spit out the id.

Zorilla
Mar 23, 2005

GOING APE SPIT
How about parent.id or this.parent.id? If those don't work, you may have to define a variable in the parent function and use it in the click callback (as seen in the updated example).

Zorilla fucked around with this message at 23:47 on Apr 14, 2009

MrData
Jun 28, 2008
Welp, after some more Googling around this seems to work fine:

code:
jQuery.each(parsedJSON.sequences, function() {
				
  var temp = this;			
  var div = '<div name="'+this.name+'"><input type="hidden" name="sequence_id[]"value="'+this.id+'"/>
<a href="#">CLICK ME</a></div>';			
  $('#sequences').append(div);
			
  $('div[name='+this.name+'] a').click(function() {		
    alert(temp.id);
  });
  });
Although I don't understand why you'd have to keep a copy of 'this' and use that in the anon. method. Isn't this doing pretty much what it did before, but now using a (reference?) copy of 'this' instead of using 'this' directly? I still have much to learn :(

edit: your updated code also works!

MrData fucked around with this message at 23:50 on Apr 14, 2009

Zorilla
Mar 23, 2005

GOING APE SPIT
You had a function within a function. The problem was that this was referring to the immediate function and not the parent one whose object had the properties you wanted.

sonic bed head
Dec 18, 2003

this is naturual, baby!

MrData posted:

Welp, after some more Googling around this seems to work fine:

code:
jQuery.each(parsedJSON.sequences, function() {
				
  var temp = this;			
  var div = '<div name="'+this.name+'"><input type="hidden" name="sequence_id[]"value="'+this.id+'"/>
<a href="#">CLICK ME</a></div>';			
  $('#sequences').append(div);
			
  $('div[name='+this.name+'] a').click(function() {		
    alert(temp.id);
  });
  });
Although I don't understand why you'd have to keep a copy of 'this' and use that in the anon. method. Isn't this doing pretty much what it did before, but now using a (reference?) copy of 'this' instead of using 'this' directly? I still have much to learn :(

edit: your updated code also works!

If you're ever planning on learning real javascript (more than UI fancyness, maybe some actual application), sans jQuery foolishness...never learn what you just said. jQuery very stupidly overwrites the this variable that's used very frequently in javascript for other things. That's my biggest problem with jQuery and why I'm still a Prototype user for anything other than adding nice event handlers.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

sonic bed head posted:

If you're ever planning on learning real javascript (more than UI fancyness, maybe some actual application), sans jQuery foolishness...never learn what you just said. jQuery very stupidly overwrites the this variable that's used very frequently in javascript for other things. That's my biggest problem with jQuery and why I'm still a Prototype user for anything other than adding nice event handlers.

Meh, I just remember to do:

code:
MyClass = function()
{
  self = this;
}
and use self inside jQuery calls when I want to refer to my class. Infinitely less painful than dealing with prototype. Although it would be nice if jQuery didn't do that.

Nigglypuff
Nov 9, 2006


BUY ME BONESTORM
OR
GO TO HELL

sonic bed head posted:

If you're ever planning on learning real javascript (more than UI fancyness, maybe some actual application), sans jQuery foolishness...never learn what you just said. jQuery very stupidly overwrites the this variable that's used very frequently in javascript for other things. That's my biggest problem with jQuery and why I'm still a Prototype user for anything other than adding nice event handlers.

:confused: In javascript, this is not a variable — it's a nullary operator that returns the receiver of the current function context. You can't directly assign it a value, and it is never captured by a closure. When invoked, every function receives a new value of this, regardless of where the function was defined, or what value of this existed in the enclosing scope of the definition.

I'm confused about what you thing jQuery is doing wrong here. The nature of Javascript means that an API which takes callbacks/closures as method parameters has no way knowing what value of this existed in the scope where the callbacks were created, so it has to set a new value of this, or allow it to default to the global object, which is rarely what people want.

As far as I know, the convention in both jQuery and Prototype is to automatically bind this in event handlers to the object which received the event. For list iteration with callbacks, jQuery automatically sets this to be the current list element, whereas Prototype passes the element to the closure as an argument. In either case it is simply a matter of API convention, and not objectively stupid.

It is a weakness of Javascript that the this pseudovariable rarely behaves the way people expect it to behave, and it can uglify otherwise pretty closure-passing code. But do you really feel that jQuery in particular handles this badly?

sonic bed head
Dec 18, 2003

this is naturual, baby!

Nigglypuff posted:

:confused: In javascript, this is not a variable — it's a nullary operator that returns the receiver of the current function context. You can't directly assign it a value, and it is never captured by a closure. When invoked, every function receives a new value of this, regardless of where the function was defined, or what value of this existed in the enclosing scope of the definition.

I'm confused about what you thing jQuery is doing wrong here. The nature of Javascript means that an API which takes callbacks/closures as method parameters has no way knowing what value of this existed in the scope where the callbacks were created, so it has to set a new value of this, or allow it to default to the global object, which is rarely what people want.

As far as I know, the convention in both jQuery and Prototype is to automatically bind this in event handlers to the object which received the event. For list iteration with callbacks, jQuery automatically sets this to be the current list element, whereas Prototype passes the element to the closure as an argument. In either case it is simply a matter of API convention, and not objectively stupid.

It is a weakness of Javascript that the this pseudovariable rarely behaves the way people expect it to behave, and it can uglify otherwise pretty closure-passing code. But do you really feel that jQuery in particular handles this badly?

Actually, you're right, my problem isn't exactly with resetting this, my problem is the very confusing syntax that makes saving this to a temporary variable necessary. Let's take MrData's code as an example. If, instead of implicitly using this in the jQuery.each function, jQuery provided us with an argument that is the current element, this wouldn't be an issue. There would be confusion as to where to get the current items reference from and there would be no having to figure out that you're supposed to use the boilerplate that Lumpy posted earlier. jQuery is just so unintuitive compared to Prototype for a lot of things. Prototype lets you bind whatever object to this by passing it as an argument to the bind or bindAsEventListener functions, but whatever it is, you control it, and if you don't explicitly set it, it is, as you said, the anonymous function's this.

Don't get me wrong, I love jQuery for all things DOM, for all things event handler, the ability to attach names to handlers and unbind and bind them in a single line is amazing. I just think that for any real javascript project, Prototype is a much better toolbox.

Sylink
Apr 17, 2004

So playing around with Ajax and I'm trying to animate adding new information when a button is clicked with the code below:

code:

		var span = "<span>what the gently caress</span><br/>";
		$(document).ready(function(){
		
		
			$("#generate").click(function(){
			
				$.get("serverTime.php", function(data){
						$("#test").append(span);
						
						$("#test span:last").hide(function () {
							$("#test span:last").append(data);
							
							
						});
					
						$("#test span:last").slideDown("slow");
						
						
						
					
					});
			});
			

		});

Basically, when a button is clicked, a new span is created and some data is retrieved from a php file via ajax.

Now I create the span empty, so nothing shows up, then I try to hide it and then append it while hidden. This is so I can slide it down and each row can appear in a slide down.

Trying to animate append through append(data).slideDown etc does not work properly.

The problem is if I leave the span empty the animation doesn't occur, the data just appears. If I put one character in then it works but you see the extra character flicker in then get hidden suddenly followed by the fade, thats why I left it empty in the first place.

You can see whats going on live here http://www.ktfoundry.com/ajax/

Zorilla
Mar 23, 2005

GOING APE SPIT

Sylink posted:


Would chaining work?
code:
<html>
<head>
<title>AJAX with jQuery</title>
<script type="text/javascript" src="jquerymin.js"></script>
</head>
<style type="text/css">
.butt {display: none;}
</style>
<body>
	<div id="wrapper">
		<input type="submit" id="generate" value="Generate!"><br />
	</div>
	<div id="test">
		
	</div>
	<script type="text/javascript">
	$("#generate").click(function() {
		$.get("serverTime.php", function(data){
			$("#test").append('<span class="butt">whatthefuck - '+data+'</span><br />')
			.hide()
			.slideDown("slow");
		});
	});
	</script>
</body>
</html>

Adbot
ADBOT LOVES YOU

Sylink
Apr 17, 2004

I actually found a solution. It turns out slideDown just sucks and I made the new spans hidden to begin with. With fadeIn it works nicely.

  • Locked thread