JS and JQuery: Get the new href only after changing it
===

I have a below anchor as below
    
    <a onclick="return getFile('/log/sample.log');" href="/log/sample.log" target="_blank"> sample.log </a>

Because at my server, the log directory in href may be not correct. So the function "getFile" would change the href to the correct one after asking the server.

The first click always failed since the link was not correct, then after AJAX process in getFile was finished and the correct href was given, the clicks later on was ok.  

The problem is how I forcefully let html wait ever at the first click until the href is changed, then do the query on the server.

Thanks in advance.

I guess my way could be not in the correct direction by using "onclick" to implement the idea. 
