Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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");
  });
}
Comment

a tag how to trigger ajax


e.preventDefault();

Comment

PREVIOUS NEXT
Code Example
Javascript :: collision javascript 
Javascript :: javascript set() handler 
Javascript :: javascript wait to execute function on keyup 
Javascript :: ~~ in javascript 
Javascript :: react form hook trigger is not a function 
Javascript :: Working with Legacy Tables sequelize 
Javascript :: javascript string insensitive compare 
Javascript :: exponent javascript 
Javascript :: js regex word before word 
Javascript :: How to make a JSON call to an URL 
Javascript :: Nuxt Use Nginx as reverse Proxy 
Javascript :: upload multiple image using jquery 
Javascript :: stack implementation in javascript using linked list 
Javascript :: set map to local storage javascript 
Javascript :: nodemon.json env 
Javascript :: tilt js vue 
Javascript :: how to update json key name while keeping the values in mysql 
Javascript :: create auto increment mongodb mongoose 
Javascript :: react native image zoom viewer 
Javascript :: convertir lista a Json en Java 
Javascript :: test one function in react class 
Javascript :: js findindex 
Javascript :: javascript canvas 
Javascript :: javascript this Inside Function with Strict Mode 
Javascript :: customize function (doc) datatable printable 
Javascript :: vue for start at index 
Javascript :: java script add fields dynamically 
Javascript :: javascript create class 
Javascript :: js event handlers 
Javascript :: how to live reload a node js app 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =