WordPress ajax serial processing of and sending


I want to install/activate plugins via ajax.But i want to add a loading class on plugins list item which is being installing or activating. In jquery If i want to do it i need to write a lot bunch of code there.For example I have 4 plugins to install.So i have to first, send first ajax request to install first plugin then when a response comes I send second request in success block but its too time consuming. I want to know if there is any easy solution. Or in php file can i send a response back then continue installing 2nd one. Is that possible??