$("#export1").change(function(){
var export2 = this.value;
if (export2 == "Csv") {
alert("csv");
$.ajax({
type: "POST",
url: "export_csv.php ",
data: "",
success: function(data) {
alert('data');// data is the return value from input.php
}
});
}
});
在改变时我试图调用PHP文件,它以CSV格式导出。任何人都可以建议我这个。
答案 0 :(得分:1)
2件事:
data: ""
。这是默认值此代码应该有效:
$("#export1").change(function(){
var export2 = this.value;
if (export2 == "Csv") {
alert("csv");
$.ajax({
type: "POST",
url: "export_csv.php",
success: function(data) {
alert(data);// data is the return value from input.php
}
});
}
});