Answers for "a tag how to trigger ajax"

0

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");
  });
}
Posted by: Guest on August-23-2021

Code answers related to "a tag how to trigger ajax"

Code answers related to "Javascript"

Browse Popular Code Answers by Language