问题遇到的现象和发生背景
ajax请求成功后,返回的data为undefined
问题相关代码,请勿粘贴截图
$.ajaxFileUpload({
url: 'http://localhost:13237/InputScoresDetailsDevelopedSunrise_Web.ashx?urlflag=4', //这里是服务器处理的代码
type: 'post',
secureuri: false, //一般设置为false
fileElementId: 'upload_file_id', // 上传文件的id、name属性名
datatype: 'json', //返回值类型,一般设置为json、application/json
async: false,
//data: {}, //传递参数到服务器
success: function (data) {
alert(typeof data);
console.log(eval(data));
console.log(eval("("+data+")"));
if (data.flag=='1') {
console.log("成功!");
sx++;
} else {
alert("文件成功处理出错!原因:" + data.error);
}
},
error: function (e) {
//console.log(e);
//alert("错误:上传组件错误,请检察网络!");
}
});
运行结果及报错内容
我的解答思路和尝试过的方法
网上说的方法都试过了,data还是为undefined, typeof data还是defined
我想要达到的结果
获取data的值