Javascript 多参数URL CORS错误

Javascript 多参数URL CORS错误,javascript,ajax,tomcat,xmlhttprequest,cors,Javascript,Ajax,Tomcat,Xmlhttprequest,Cors,我必须点击一个网址说http://localhostName:8080/TestModule?paramA=3432¶mB=0.我的代码不适用于具有多个参数的URL,但是,对于单个参数,例如,它工作得非常好http://localhostName:8080/TestModule?paramA=3432.有人能告诉我发生这种情况的原因吗?任何帮助都将不胜感激。提前谢谢 我正在使用下面启用CORS的调用执行xhr调用 function createCORSRequest(method, ur

我必须点击一个网址说
http://localhostName:8080/TestModule?paramA=3432¶mB=0.
我的代码不适用于具有多个参数的URL,但是,对于单个参数,例如
,它工作得非常好http://localhostName:8080/TestModule?paramA=3432.
有人能告诉我发生这种情况的原因吗?任何帮助都将不胜感激。提前谢谢

我正在使用下面启用CORS的调用执行xhr调用

function createCORSRequest(method, url) {
  var xhr = new XMLHttpRequest();
  if ("withCredentials" in xhr) {
    // XHR for Chrome/Firefox/Opera/Safari.
    xhr.open(method, url, true);
  } else if (typeof XDomainRequest != "undefined") {
    // XDomainRequest for IE.
    xhr = new XDomainRequest();
    xhr.open(method, url);
  } else {
    // CORS not supported.
    xhr = null;
  }
  return xhr;
}
另外,我在tomcat的web.xml中添加了以下过滤器,并在tomcat的lib中添加了所需的cors-filter-2.1 jar和java-property-utils-1.7.1.jar

<filter>
    <filter-name>CORS</filter-name>
    <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CORS</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

科尔斯
com.thetransactioncompany.cors.CORSFilter
科尔斯
/*

这只是一个错误的URL问题,是在TestModule之后添加的,它开始工作了。:)<代码>http://localhostName:8080/TestModule/?paramA=3432

应该是零差异。这是querystring中的实际值吗?不,实际值有点不同,但格式相同。paramA和paramB分别是functionId和functionType,localhostName是localhost。如果我在浏览器中使用两个参数点击示例URL,它就可以正常工作。它显示了响应。但只有在FireFox中,只有通过xhr调用访问时才会抛出CORS错误。