jQuery 未使用 Uploadify 发送 var
jQuery var not being sent with Uploadify
我有以下代码块。 Uploadify 本身工作正常,但是发送 jquery 变量的自定义表单数据根本没有发送到脚本。然而,如果我将它设置为 1 或一些基本文本,它工作正常。我错过了一些非常简单的东西吗?完成时的警报显示数据正常。
jQuery:
$(function() {
var scheduledImageDesc = '';
$('#scheduledImageDesc').on("keyup change", function(e) {
scheduledImageDesc = $(this).val();
});
$('#file_upload').uploadify({
'formData' : {
'scheduledImageDesc': scheduledImageDesc,
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'buttonText' : 'Upload New Image',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadifyScheduledImage.php',
'fileExt' : '*.jpg; *.jpeg; *.JPG; *.JPEG;',
'multi' : true,
'auto' : true,
'fileSizeLimit' : '4MB',
//'checkExisting' : 'uploadify/check-exists-scheduled-image.php',
'onQueueComplete' : function(data) {
//location.reload();
alert(scheduledImageDesc);
}
});
});
已解决,我不得不添加另一个函数以便在发送之前从我正在使用的输入字段获取更新。如果其他人遇到困难,这对我有用。
jQuery:
var scheduledImageDesc = '';
$('#scheduledImageDesc').on("keyup change", function(e) {
scheduledImageDesc = $(this).val();
});
$('#file_upload').uploadify({
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'buttonText' : 'Upload New Image',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadifyScheduledImage.php',
'fileExt' : '*.jpg; *.jpeg; *.JPG; *.JPEG;',
'multi' : true,
'auto' : true,
'fileSizeLimit' : '4MB',
'onUploadStart' : function(file) {
$("#file_upload").uploadify("settings", "formData", {"scheduledImageDesc": scheduledImageDesc});
},
//'checkExisting' : 'uploadify/check-exists-scheduled-image.php',
'onQueueComplete' : function(data) {
//location.reload();
alert(scheduledImageDesc);
}
});
我有以下代码块。 Uploadify 本身工作正常,但是发送 jquery 变量的自定义表单数据根本没有发送到脚本。然而,如果我将它设置为 1 或一些基本文本,它工作正常。我错过了一些非常简单的东西吗?完成时的警报显示数据正常。
jQuery:
$(function() {
var scheduledImageDesc = '';
$('#scheduledImageDesc').on("keyup change", function(e) {
scheduledImageDesc = $(this).val();
});
$('#file_upload').uploadify({
'formData' : {
'scheduledImageDesc': scheduledImageDesc,
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'buttonText' : 'Upload New Image',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadifyScheduledImage.php',
'fileExt' : '*.jpg; *.jpeg; *.JPG; *.JPEG;',
'multi' : true,
'auto' : true,
'fileSizeLimit' : '4MB',
//'checkExisting' : 'uploadify/check-exists-scheduled-image.php',
'onQueueComplete' : function(data) {
//location.reload();
alert(scheduledImageDesc);
}
});
});
已解决,我不得不添加另一个函数以便在发送之前从我正在使用的输入字段获取更新。如果其他人遇到困难,这对我有用。
jQuery:
var scheduledImageDesc = '';
$('#scheduledImageDesc').on("keyup change", function(e) {
scheduledImageDesc = $(this).val();
});
$('#file_upload').uploadify({
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'buttonText' : 'Upload New Image',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadifyScheduledImage.php',
'fileExt' : '*.jpg; *.jpeg; *.JPG; *.JPEG;',
'multi' : true,
'auto' : true,
'fileSizeLimit' : '4MB',
'onUploadStart' : function(file) {
$("#file_upload").uploadify("settings", "formData", {"scheduledImageDesc": scheduledImageDesc});
},
//'checkExisting' : 'uploadify/check-exists-scheduled-image.php',
'onQueueComplete' : function(data) {
//location.reload();
alert(scheduledImageDesc);
}
});