Fix wait_for_ajax method

The title say it all