.then & .done method to synchronize both ajax queries