Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

AJAX JAVASCRIPT FUNCTION CALLS

function ajaxGetRequest(path, callback){
  let request = new XMLHttpRequest();
  request.onreadystatechange = function(){
    if (this.readyState === 4 && this.status === 200){
        callback(this.response);
    }
  };
  request.open("GET", path);
  request.send();
}

function ajaxPostRequest(path, data, callback){
  let request = new XMLHttpRequest();
  request.onreadystatechange = function(){
    if (this.readyState === 4 && this.status === 200){
      callback(this.response);
    }
  };
  request.open("POST", path);
  request.send(data);
}
Comment

how to call ajax javascript

var xhr = new XMLHTTPRequest();
Comment

PREVIOUS NEXT
Code Example
Javascript :: sequelize contains 
Javascript :: get keys of object js 
Javascript :: Object.Values () javascript 
Javascript :: sort array of numbers 
Javascript :: redux toolkit store 
Javascript :: javascript update value when slider moves javascript 
Javascript :: set property js 
Javascript :: javascript get last word in string 
Javascript :: map javascript 
Javascript :: reverse string in javascript 
Javascript :: add one month to date javascript 
Javascript :: pdfjs get all the text present 
Javascript :: web3 connect to smart contract 
Javascript :: iteratea on values map js 
Javascript :: js get innertext minus the span text 
Javascript :: js check if map contains key 
Javascript :: NodeJS 10.24.1 
Javascript :: experss cookie session 
Javascript :: switch for comparing greater value 
Javascript :: vue css 
Javascript :: JavaScript array to URL params 
Javascript :: reverse a string 
Javascript :: object promise javascript 
Javascript :: convert integer month to string month react native 
Javascript :: json object 
Javascript :: Ping discord 
Javascript :: wait until 
Javascript :: scroll up own 
Javascript :: javascript for in 
Javascript :: make table responsive react-bootstrap-table2 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =