Hello everyone, there is a general link:
<a href="http://google.ru" onclick="return myFunc('123', 'abx')">Click</a> There is a function in javascript:
var myFunc = function() { $.ajax({ type: "POST", url: "", data: { id: id, updated_at: updated_at }, success: function (result) { if(result == 'ok') { return true; } else { alert('error'); return false; } } }); } I need to cancel the link click if ajax returned alert ('error').return false does not help. What can be done in this case?
if (result == 'ok')block, either directly go to google.ru , or trigger a click on the link (and not to get hung up, use the flag). - Regentreturnin thesuccessfunction will be useless from the word "completely". - Regent