jquery - GIF stopped before create elements in Javascript -


I am trying to develop a bit "loader" using a simple GIF image. Although the data is being received from the server, I show a loading message with my normal loading GIF.

However, when the data is successfully received and I try to make a simple tree (experiment), the GIF stops, until it does not completely build the tree.

What can I do to avoid this behavior? Something like thread in the OS (one thread to create GIF pictures and other for tree construction).

This is my source code:

  // loading GIF $ ('# loading-tree display', 'inline') ') CSS (. ; $ .ajax ({url: 'index.php / home / getWebTree /' + + ticket + '/' + user name + '/' + + + wal + '/ true' ', datatype:' jason ', success: Work (data) {createTree (Data, 'TT1'); // Tree was made $ ('# loading-tree') when Hide GIF loading. CSS ('Display', 'None');} });   

Thanks!

Javascript is not threaded Many h There are several ways to simulate threading so far (to see.) The best way to get what you want to do is to generate a tree on server side and send the client as HTML and then Insert it in your page, in this way you will not decompose the loading graphic.

Comments