Does it not work without this line?  If there's any ajax happening, it should automatically wait for it to finish.