Sample code for 30+ languages & platforms
JavaScript

Example: Http.QuickGetSb method

Demonstrates the QuickGetSb method.
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;

var http = new CkHttp();

// Send the HTTP GET and return the content in a StringBuilder
var sb = new CkStringBuilder();
success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb);
if (http.LastMethodSuccess == false) {
    if (http.LastStatus == 0) {
        // Communications error.  We did not get a response.
        console.log(http.LastErrorText);
    }
    else {
        console.log("Response status code: " + http.LastStatus);
        console.log("Response body error text:");
        console.log(sb.GetAsString());
    }

    return;
}

// The downloaded content:
console.log(sb.GetAsString());
console.log("Success");