I want to make a chrome extension. I need to get the response JSON what can be seen in chrome's developer tools. It's a post by using fetch. Which API or javascript way can I use?
Just use Fetch API (another good alternative is axios )
example:
async function getData() {
try {
const response = await fetch('https://your-res-website.com');
const resJson = await response.json();
return resJson;
} catch (error) {
console.warn('getData error', error);
}
return null;
}
getData().then(data => console.log(data));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.