Unlike the fetch() API, which is Promise-based, the ajax() method is actually Observable-based, which makes our job a little easier. Using it is quite straightforward, like so:
Rx.Observable .ajax('https://swapi.co/api/people/1') .map(r => r.response) .subscribe(data => console.log('from ajax()', data));
As we can see, the preceding code calls the ajax() operator with a URL as an argument. The second thing worthy of mentioning is the call to the map() operator, which digs out our data from the response property. Because it is an Observable, we just have to subscribe to it as usual by calling the subscribe() method and providing it with a listener function as an argument.
This covers a simple case when you want to fetch data ...