Wait for ajax to return before submit