I have been looking at this SO post: JavaScript post request like a form submit
and I have a slightly different situation. Have this curl command which works:
curl -v -X POST -H "application/json" -H "Content-type: application/json" -d 'some json' http://127.0.0.1:9010/api/kpi
but now I need to put this sort of a thing into a JavaScript file and it obviously breaks.
Could someone please help me create this in JavaScript?
Thanks!