the below script is a simple XML rate request to UPS and it works on my local PC via IE but not Chrome. When I moved over to my iis web server (workgroup member) it continually fails with:
Origin https://www..com not found in Access-Control-Allow-Origin header. XMLHttpRequest: Network Error 0x80070005, Access is denied.
I thought this would be a simple fix with all the CORS searching however, I have had zero luck with all my efforts.
Any help would be greatly appreciated as to how I can get this to work on the web server.
Much of the data and credentials have been change to protect personal information.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script language="javascript">
var XMLHttpRequestObject = false;
var xmlRequest = "<this will contain a well formatted XML to UPS that was proved to work";
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
XMLHttpRequestObject.overrideMimeType("text/xml");
}
function getRates()
{
var xmlResponse;
var ratedShipment;
if(XMLHttpRequestObject)
{
var obj = document.getElementById('targetDiv');
XMLHttpRequestObject.open("POST", "https://wwwcie.ups.com/ups.app/xml/Rate", true);
XMLHttpRequestObject.onreadystatechange = function()
{
if(XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200)
{
xmlResponse = XMLHttpRequestObject.responseXML;
displayRates(xmlResponse);
}
}
XMLHttpRequestObject.send(xmlRequest);
}
}
function displayRates(argXML)
{
// Will display rates in html table
}
</script>
</head>
<body>
</body>
</html>
User contributions licensed under CC BY-SA 3.0