Changing ajax call to asynchronous