結果 : how to make javascript function wait for ajax response