Possible to do web API calls?

I am primarily a PHP programmer and was wondering if RPG Maker MV can do a web api call to a website where i have a PHP script running that returns json data. For example, say I wanted RPG Maker MV to have a door which is openable only if an API call (which sends Door ID) to my PHP script says it's openable. Just trying to figure out if it is possible to externally control elements in the game. (if my website was down or not reachable, the game would just automatically treat that as "not openable"). So what would be the way to do this?
I've never tried it, but since RMMV uses JavaScript, it should be as simple as sending an AJAX request.
https://www.w3schools.com/xml/ajax_intro.asp
Ok, cool, I know how to do js ajax requests. So I can just embed my own custom js code? Sorry, am new to this, what is the correct way to do that? please point me to a tutorial if available, thanks!
RPG Maker MV essentially runs on Chromium, which means that anything you can do on a normal browser (front-end), you can do it in MV.

If you have the latest version of MV (1.6.0+), you should be able to use the fetch() API, otherwise you'll have to use XmlHttpRequest(). You can even import the jQuery library and use ajax() if you prefer that.

To do this, you want to write your code in a .js file and save it to your js/plugins folder in your project. Then, in the editor you can import your plugin from the Plugin Manager button.

Here's an example for inspiration:
https://forums.rpgmakerweb.com/index.php?threads/simple-ajax-request-data-from-a-web-server.48720/
Awesome, thanks for the guidance!

Original thread: https://forums.rpgmakerweb.com/threads/possible-to-do-web-api-calls.96346/