Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

delete request from the script to html

// importing elemenets from html
let deleteEl = document.getElementById("delete");
let deleteInputEl = document.getElementById("deleteInput")
let deletResultsEl = document.getElementById("deleteResults")


const display = (data) =>{
  // data = JSON.stringify(data)
  for(let each of data){
    let para = document.createElement('p')
    each = JSON.stringify(each)
    para.innerHTML = each
    getResultel.appendChild(para)
  }
}

const deleteMethod = () =>{
        let url = deleteInputEl.value;
        let options = {
            method: "DELETE"
        };
        fetch(url, options)
            .then(function(response) {
                alert("Data deleted successfully")
            })
            
}

deleteEl.addEventListener("submit", function(event){
    event.preventDefault();
    deleteMethod();
  });
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue cli tailwind config 
Javascript :: javascript Assigning to a non-writable property is not allowe 
Javascript :: Play and Pause media for HTML5 using JS/Javascript 
Javascript :: how to highlight active screen react native 
Javascript :: foreach in the elements with a data attibute jquery 
Javascript :: express proxy 
Javascript :: iconify react 
Javascript :: NodeJS router model 
Javascript :: js retrieve form data 
Javascript :: function inside a class component react 
Javascript :: how to find the radius of a loacation in node js 
Javascript :: check if date is less than today moment 
Javascript :: autocomplete required material ui 
Javascript :: how to navigate to another page with settimeout reactjs 
Javascript :: preview multiple image before upload 
Javascript :: filter in javascipt 
Javascript :: hot to set file views in nodejs 
Javascript :: what is symbol in javascript 
Javascript :: apar chinmoy phy js code 
Javascript :: js check if array contains value 
Javascript :: js store function in variable 
Javascript :: tinymce editor description value is not getting onclick js 
Javascript :: install svelte routing 
Javascript :: reverse array in javascript 
Javascript :: javaScript getDate() Method 
Javascript :: nextjs override page route 
Javascript :: nodejs express routing get 
Javascript :: whatare portals in react 
Javascript :: disable livewire error model 
Javascript :: return array javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =