What I\'m trying to do
Post from a local html/javascript website to an online PHP file.
Problem
When I attempt to
Due to chrome security settings, to make an XMLHttpRequest you need a valid origin and a valid destination.
The destination is a valid domain, and because you have Access-Control-Allow-Origin enabled, you can make a request from different origin.
But the origin is not a valid domain, because you are doing a request from a local page.
The origin must be a valid host/identifier (domain for a website, identifier for a browser extension, application id for a webview embedded into an application).
You have these option to solve the issue:
disable browser security settings: sample for chrome:
chromium-browser --disable-web-security --user-data-dir
check this answer, for how to use: https://stackoverflow.com/a/3177718/5081328
embed your page into an application and use a webview
Create a browser extension to load your page