小编ost*_*che的帖子

如何使用jQuery获取附件文件内容

get我的响应上content-disposition: attachment;filename=f.csv,我需要在页面上下载此文件的内容.
$.ajax请求我有一个错误.如何使用jQuery ajax(或get)获取文件内容?
UPD

error: function( jqXHR, textStatus, errorThrown ) {
  console.log( jqXHR, textStatus, errorThrown );
}  
Run Code Online (Sandbox Code Playgroud)

得到

Object {
    ...
    readyState 0
    responseText ""
    status 0
    statusText "error"
}, error,  
Run Code Online (Sandbox Code Playgroud)

UPD 2
我找到了一个jquery.fileDownload插件,但它显示了带有保存打开对话框的浏览器窗口,如下所示: 保存/打开对话框
但我需要获取文件内容.
我不需要在电脑上下载文件.

UPD 3
完整代码列表:

$.ajax( {
    url: link,
    crossDomain: true,
    dataType: "text",
    success: function( data, textStatus, jqXHR ) {
        alert( data );
    },
    error: function( …
Run Code Online (Sandbox Code Playgroud)

ajax jquery file

7
推荐指数
1
解决办法
8148
查看次数

three.js在飞机上旋转相机

我的应用中有一个相机:

camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
camera.position.z = 1;
camera.position.y = -5;
camera.rotateOnAxis(new THREE.Vector3(1, 0, 0), degInRad(90));
camera.up = new THREE.Vector3(0, 0, 1);  
Run Code Online (Sandbox Code Playgroud)

render当我按下键时,功能中的代码必须旋转相机:

if (leftPressed) {
    camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(1));
} else if (rightPressed) {
    camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(-1));
}
if (upPressed) {
    camera.rotateOnAxis((new THREE.Vector3(1, 0, 0)).normalize(), degInRad(1));
} else if (downPressed) {
    camera.rotateOnAxis((new THREE.Vector3(1, 0, 0)).normalize(), degInRad(-1));
}  
Run Code Online (Sandbox Code Playgroud)

相机旋转,但不是我需要的方式.我希望那台相机在飞机上像FPS(第一人称射击游戏)一样旋转.看图片了解我想要的东西......
我试着用它sin(1),cos(1)但无法理解它是如何rotateOnAxis工作的,使translate功能像魅力一样工作,并将相机移动到她所看到的方向.
PS …

javascript camera rotation perspectivecamera three.js

4
推荐指数
2
解决办法
2万
查看次数

QPushButton QGridLayout的单元格高度的100%

qroupBoxButtons = new QGroupBox();  
QGridLayout *layout = new QGridLayout;  

pushButtonPlus = new QPushButton( tr( "+" ) );  
layout -> addWidget( pushButtonPlus, 1, 1 );  
/* add another elements to layout */  
layout -> setColumnStretch( 1, 25 );  
/* set column stretch to other columns */  
qroupBoxButtons -> setLayout( layout );  
/* add qroupBoxButtons to another QGroupBox's layout  
Run Code Online (Sandbox Code Playgroud)

我正在尝试像这样设置100%的高度:

pushButtonPlus -> setStyleSheet( " QPushButton { height: 100%; } " );  
Run Code Online (Sandbox Code Playgroud)

要么:

pushButtonPlus -> setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored );
Run Code Online (Sandbox Code Playgroud)

但这不正常。按钮始终具有100%的宽度,只有标准高度。当窗口调整大小时,它保持在一个高度。

如何在不使用resize事件的情况下设置100%的高度?

height qt qgridlayout qpushbutton

2
推荐指数
1
解决办法
1290
查看次数