refactor ajax option loading issue