I am using this piece of code to make text button on web page
<a href='#' onclick="new Ajax.Updater('history', '/responsesG', {parameters: {name: '%s', port: '%s', profil: '201', action: 'profile'},
insertion: Insertion.Top}
); return false;">Do something</a>
since it is costly call I would like to prevent user from multiple clicking it since it makes asynchronous call and they get for instance 3 responses for same thing (since response last for 3 to 5 seconds) i tried option
asynchronous: false
with same success(failure). How can I do it?
Edit:
<a href="#" onclick="diagnostika('mac_adresa');return false;">-Mac address</a>
<script type="text/javascript">
function diagnostika(akcija) {
if(!this.clicked) {
this.clicked = true;
button = this;
new Ajax.Updater('history', '/responsesG', {
parameters: {
name: '%(name)s',
port: '%(port)s',
action: akcija},
insertion: Insertion.Top,
onComplete: function() {
button.clicked = false;}});}
return false;};
</script>
This is what I implemented in the end.