Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

http get request js

function httpGetAsync(theUrl, callback) {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function() { 
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
            callback(xmlHttp.responseText);
    }
    xmlHttp.open("GET", theUrl, true); // true for asynchronous 
    xmlHttp.send(null);
}

httpGetAsync("/api/v1/items", (res)=>{
  	// page content is in variable "res"
});
Comment

js get request

document.addEventListener("DOMContentLoaded", function() {
    const xmlHttp = new XMLHttpRequest(),
        div = document.getElementById('music_all_ajax');
    xmlHttp.open("GET", '{{ route('music ') }}', false); // false for synchronous request
    xmlHttp.send(null);

    div.insertAdjacentHTML('afterbegin', xmlHttp.responseText);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to import modules js 
Javascript :: { use UnifiedTopology: true } 
Javascript :: sum of array javascript 
Javascript :: what is undefined 
Javascript :: How to blacklist words with discord.js 
Javascript :: how to encode uri in prereuqest script postman 
Javascript :: date.gettime is not a function 
Javascript :: playwright headless 
Javascript :: switch react router 
Javascript :: js library for unique id uniqid 
Javascript :: listing range in javascript 
Javascript :: angular array export to excel 
Javascript :: js download file from webserver 
Javascript :: how to redirect a form to another page when we submitted a form in react js 
Javascript :: flatten nested json objects 
Javascript :: animejs reduce the speed 
Javascript :: javascript Example 1: Regular Expressions 
Javascript :: canvas drawimage resize quality 
Javascript :: react native run real device 
Javascript :: javascript spread array without duplicates 
Javascript :: does pycharm support javascript 
Javascript :: mongoosejs 
Javascript :: The missing value javascript 
Javascript :: define member in discord.js 
Javascript :: javascript list class properties 
Javascript :: how to calculate bmi 
Javascript :: string theory 
Javascript :: javascript function return boolean 
Javascript :: in vs of javascript 
Javascript :: convert data image url into an image file 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =