chrome-extensionMake request using XMLHttpRequest
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(r) {
  if ( xhr.readyState == 4 ) {
    console.log(xhr.responseText);
  }
});
xhr.open('GET', 'https://example.org/');
xhr.send();ctrl + c| new XMLHttpRequestcreate  | onreadystatechangehandle request processing | 
| example.org/send request to this URL | readyState == 4request has been executed | 
| console.log(xhr.responseText)place your code to process response here | 'GET'use GET method for request | 
| xhr.send()send the request | |
More of Chrome Extension
- Get active tab ID
- How to add jQuery support to content script in Chrome extension.
- Set cookie value and expiration time
- How to do a POST request
- Inject HTML into page
- How to listen for button click in popup script
- How to simulate keypress/keyup/keydown event on a page
- Inject CSS into page
- How to find folder where Google Chrome extensions are stored.
- How to make XHR request in Chrome extension
See more codes...