let run long runing task in background in javascript

So When I am in javascript development I had a long running javascript method which delays page loading. So I wanted to make it run in background to protect responsiveness of application. So I found Differed execution in Jquery.  Using differed execution we can run functions in background and do another stuffs as we want. And we can pass callback function to execute on after finishing the long running function. Code Sample on jsfiddle

Bootstrap loading effects in button

It is nice to show loading behavior to user and let user no something is happening which take some time and avoid touching UI. In bootstrap it is very simply task. I think it might help you $(this).button(‘loading’) shows loading text in button. we tell this to bootstrap by using data-loading-text=”Loading…”  When finishing our long runing logic we can call $(this).button(‘reset’); This will bring button to original state.