You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
462 B

  1. # Javascript
  2. Below is an example of making a HTTP request to SITE_NAME from Node.js.
  3. ```js
  4. var https = require('https');
  5. https.get('PING_URL').on('error', (err) => {
  6. console.log('Ping failed: ' + err)
  7. });
  8. ```
  9. You can also send pings from a browser environment. SITE_NAME sets the
  10. `Access-Control-Allow-Origin:*` CORS header, so cross-domain AJAX requests work.
  11. ```js
  12. var xhr = new XMLHttpRequest();
  13. xhr.open('GET', 'PING_URL', true);
  14. xhr.send(null);
  15. ```