JS调用webservice,发送XML返回XML,已知发送成功,为什么接不了返回的xml ,No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin

//创建异步对象

        var xmlhttp=new XMLHttpRequest()
        xmlhttp.open("POST", URL, true);
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlhttp.send(data);
        document.getElementById("myDiv").innerHTML=xmlhttp.responseXML;



        alert(myDiv)

代码中请求的URL是一个可正常接受POST请求的API吗?

跨域问题
https://www.jianshu.com/p/89a377c52b48

在服务端的request设置ContentType

你这个是跨域的问题 你可以通过标签来加载返会的内容 这样可以避免