$(document).ready(
function() {
$('#file_upload').uploadify(
{
'swf' : '${root}uploadify/uploadify.swf',//上传按钮的图片,默认是这个flash文件
'uploader' : '${root}importFile', //上传所处理的服务器
'cancelImg' : 'uploadfiy/uploadify-cancel.png',//取消图片
'fileTypeDesc' : 'excle2003文件',//允许上传的文件类型的描述,在弹出的文件选择框里会显示
'fileTypeExts' : '*.xls',//允许上传的文件类型,限制弹出文件选择框里能选择的文件
'uploadLimit' : 1,
'queueSizeLimit' : 1,
'method' : 'post',
'buttonText' : '请选择文件',
'onUploadSuccess' : function(file, data, response) {
try {
var json = $.parseJSON(data);
$('#msg').html(
json.msg + '。记录数为:'
+ json.recordCount);
} catch (e) {
}
},
progressData : 'speed',
'auto' : false,
'multi' : false,
'onError' : function(errorType, errObj) {
alert('The error was: ' + errObj.info)
},
'onUploadError' : function(file, errorCode,
errorMsg, errorString) {
alert('The file ' + file.name
+ ' could not be uploaded: '
+ errorString);
}
});
});
function checkData() {
var data = $('#questionType').val();
if (data == '0') {
alert("请选择题目内容分类");
return false;
}
return true;
}
function upload() {
if (!checkData())
return false;
var formData = {
'questionType' : $('#questionType').val()
};
alert(formData.questionType);
$('#file_upload').uploadify('settings', 'formData', formData);
$('#file_upload').uploadify('upload', '*');
}
请选择${ranges.title}
<div class="form-group">
<input type="button" value="上传" class="btn btn-default"
onclick="javascript:upload();" />
</div>
<div style="color: red; margin: auto;" id="msg"></div>
</div>
</div>
后台获取 questionType的value值,获取不到这是什么问题