結果 : make javascript function synchronous