Run this file on your local machine without a web server
It should fail because (a) chrome doesn't allow requests on a local machine (b) submit.php doesn't exist (or shouldn't in this directory)
But it claims to succeed!
| <script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
| <script> | |
| function callback() { console.log("SUCCESS... even though success is impossible because the file doesn't exist"); } | |
| d3.xhr('submit.php', 'application/x-www-form-urlencoded', callback) | |
| .header('content-type', 'application/x-www-form-urlencoded') | |
| .post('data=' + encodeURIComponent(JSON.stringify({hello: "world"}, null, " "))) | |
| .on('error', function (error) { | |
| console.log('ERROR: ' + error); | |
| }); | |
| </script> |