Dimitri Vorontzov Dimitri Vorontzov - 1 year ago 84
Javascript Question

Load content from database, then fade in, using jQuery

I get content from MySQL database and output it into

#content div

I want that div to be invisible by default, and smoothly appear after the content has loaded.

I know it's super-easy but for the life of me I can't remember how to do it.

Answer Source

In JQuery you can add

$(document).ready(function()  {
    $('div#id_of_div').html("<?php $content; ?>");

But there are many ways for showing content , you can use fadeIn("slow"). to give effect.

You can also use ajax inside ready function. It all depends on you and the way you wish to fetch data.