Update main.js

Implement autocomplete loading apis without write inflexible.