a tag how to trigger ajax
document.querySelector("#myId").onclick = function(e) {
e.preventDefault();
$.ajax({
url: 'api_url',
type: 'post',
data: {key: 'value'},
})
.done(function() {
console.log("success");
})
.fail(function() {
console.log("error");
});
}