1 回答
TA贡献1871条经验 获得超13个赞
在你的JavaScript 中:
var form = document.forms.namedItem("excelForm");
form.addEventListener('submit', function(ev){
oData = new FormData(this);
oData.append("CustomField", "This is some extra data");
var oReq = new XMLHttpRequest();
oReq.onreadystatechange= function(oEvent){
if(this.readyState == 4 && this.status == 200){
$("#downloadButton").attr("style", "visibility: visible;")
alert(this.responseText)
} else {
alert(this.status);
}
};
oReq.send(oData);
ev.preventDefault();
}, false);
// ensure that your php file is in the correct directory and is using '.php'
oReq.open("POST", "./excel.php");
// don't forget to send
oReq.send();
在您的PHP文件中:
// your class and method goes here
public function actionexcel(){ ... }
echo $class->actionexcel();
- 1 回答
- 0 关注
- 216 浏览
添加回答
举报