Changed method to jquery.wait