fixed async problem with AJAX call
first commit