Skip to content

Instantly share code, notes, and snippets.

@kn9ts
Created April 18, 2017 09:33
Show Gist options
  • Save kn9ts/0f6c8d0adf87d31ab64622e60f7941e9 to your computer and use it in GitHub Desktop.
Save kn9ts/0f6c8d0adf87d31ab64622e60f7941e9 to your computer and use it in GitHub Desktop.
const request = new XMLHttpRequest();
request.open('POST', 'https://vitumob.xyz/order', true);
request.setRequestHeader('Accept', 'application/json, */*');
request.setRequestHeader('Content-Type', 'application/json;charset=utf-8');
request.onload = () => {
if (request.readyState === request.DONE && request.status === 200) {
component.order = JSON.parse(request.responseText);
console.log('order: http://vitumob.xyz/cart/' + component.order.order_hex);
}
};
request.onerror = (error) => { console.error(error); };
const orderToString = JSON.stringify({ order: JSON.stringify(order) });
request.send(orderToString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment