Sagar T
Sagar T

Reputation: 89

How to call Other Application API from Script in Service-Now

I write some API using Django in Python, I want to call this API's from service now from script.

I try to call my API using jQuery but it is not wokring for me, i search on net they said use $j as jQuery in service-now but it is also not working.

i want to test My API's, it is working fine or not.

Please tell me or correct me if i missing any step or any one knows how i implement this.

Upvotes: 0

Views: 876

Answers (1)

Gordon Mohrin
Gordon Mohrin

Reputation: 609

You should use vanilla javascript. If you're making the call from the client, this should work:

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
    if (xhr.readyState == XMLHttpRequest.DONE) {
        alert(xhr.responseText);
    }
}
xhr.open('GET', 'http://example.com', true);
xhr.send(null);

Take a look at this thread: How to get the response of XMLHttpRequest?

Upvotes: 1

Related Questions