Sorry, I could not resist ;o)

// enclosure
(function () {
// key elements selected only once
var $THAT = $(that) , // must be valid dom node
$verb_content = $("#verb-content") ,
$adj_content = $("#adj-content") ,
$subj_content = $("#subj-content") ;
// core logic
function loop ( ARR, $C, TC  )
{
var verbTime = ~~(Math.random()*TC);
for(var i = 0; i<ARR.length; i++){
  $C.fadeOut(
        verbTime,
        function(){$THAT.text(ARR[i]).fadeIn(verbTime);}
     );
  }
}

jQuery.ajax({
type : "POST",
dataType : "json",
url : "js/tsbtw-object.js",
success : function(data, statusText){
loop( data.verbs, $verb_content, 1000 ) ;
loop( data.adjectives,  $adj_content,  2000 ) ;
loop( data.subjects, $subj_content, 3000 ) ;
},
 error: function (xhr, ajaxOptions, thrownError){
             your_logger(xhr.statusText, thrownError);
        }
}) ; // eof ajax()
})() ;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to