Sample code for 30+ languages & platforms
JavaScript

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

var http = new CkHttp();

// Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
var requestBody = "{ \"abc\": 123 }";
var resp = new CkHttpResponse();
success = http.HttpStr("DELETE","https://example.com/something",requestBody,"utf-8","application/json",resp);
if (success == false) {
    console.log(http.LastErrorText);
    return;
}

console.log("Response status: " + resp.StatusCode);
console.log("Response body: ");
console.log(resp.BodyStr);