Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JS创建新窗口时拒绝访问/权限_Javascript_Jquery_Internet Explorer 11 - Fatal编程技术网

Javascript JS创建新窗口时拒绝访问/权限

Javascript JS创建新窗口时拒绝访问/权限,javascript,jquery,internet-explorer-11,Javascript,Jquery,Internet Explorer 11,我正试图用servlet返回的HTML创建一个新窗口,但我一直在使用这两种方法 脚本5:访问被拒绝 或 脚本70:权限被拒绝 这是我以前使用过的代码,不知道为什么现在不起作用 javascript函数: function getVerification() { var userId = jQuery('#userId').val(); jQuery.ajax({ url: 'WorkRequest', type: 'GET', data: { form

我正试图用servlet返回的HTML创建一个新窗口,但我一直在使用这两种方法

脚本5:访问被拒绝

脚本70:权限被拒绝

这是我以前使用过的代码,不知道为什么现在不起作用

javascript函数:

function getVerification() {
  var userId = jQuery('#userId').val();
  jQuery.ajax({
    url: 'WorkRequest',
    type: 'GET',
    data: {
      formType: 'getVerificationHTML',
      userId: userId
    },
    dataType: 'html',
    async: false,
    success: function (responseText) {
      alert(responseText);
      var newWin = window.open("Verification", '_blank');
      newWin.document.write(responseText);
      newWin.document.close();
    }, 
    error: function (request, status, error) {
      alert(error);
    }
  });
}
错误是在上生成的

newWin.document.write(responseText)

servlet返回的HTML格式正确


如果有帮助的话,我使用的是带有IE11(Edge)的Tomcat服务器。

asynch:false
是一种输入错误(
aync
没有h),但您无论如何都不想这样做……同步AJAX不受欢迎,因为它产生了糟糕的用户体验。由于您通过回调正确地处理了响应,所以实际上您也不需要它。@Alexinock:不,它不需要。谢谢你的尝试,tho。更新:在Chrome上运行,效果很好。我认为这是IE的问题。您的代码似乎是正确的,因为您希望显示来自服务器的一些内容,您有什么理由不能放弃AJAX请求并运行
窗口http://www.example.com/WorkRequest?formType=getVerificationHTML&userId=“+userId,”[u blank')
directly?
asynch:false
是一种输入错误(
aync
没有h),但您无论如何都不想这样做……同步AJAX不受欢迎,因为它产生了糟糕的用户体验。由于您通过回调正确地处理了响应,所以实际上您也不需要它。@Alexinock:不,它不需要。谢谢你的尝试,tho。更新:在Chrome上运行,效果很好。我认为这是IE的问题。您的代码似乎是正确的,因为您希望显示来自服务器的一些内容,您有什么理由不能放弃AJAX请求并运行
窗口http://www.example.com/WorkRequest?formType=getVerificationHTML&userId=“+userId,”[u blank')直接?