我想要点击我在这里按下的按钮
$(".J-fileup").uploadify({
'formData': {},
'swf': '/assets/uploadify/uploadify.swf',
'uploader': '/admin/resource/upload',
'cancelImg': '/assets/uploadify/uploadify-cancel.png',
'onUploadSuccess': function (file, data, response) {
var data = JSON.parse(data);
if (data.status == 1) {
//--I want id of the button that I pressed here
}
}
});
答案 0 :(得分:0)
您甚至可以使用:
$(".J-fileup").each(function() {
var $jfileup = $(this);
// Now you can use $jfileup.attr('id') to get the id.
$jfileup.uploadify({
'formData': {},
'swf': '/assets/uploadify/uploadify.swf',
'uploader': '/admin/resource/upload',
'cancelImg': '/assets/uploadify/uploadify-cancel.png',
'onUploadSuccess': function (file, data, response) {
var data = JSON.parse(data);
if (data.status == 1) {
// use $jfileup.attr('id')
//--I want id of the button that I pressed here
}
}
});
});
答案 1 :(得分:0)
您可以执行以下操作:
'onUploadSuccess': function (file, data ,response,event) {
var data = JSON.parse(data);
if (data.status == 1) {
var buttonId = event.target.id;
if(typeof buttonId!= 'undefined'){
//Do what you want to do here.
}
}
}
答案 2 :(得分:0)
使用 uploadify 的onSelect
回调:
'onSelect': function(event, ID, fileObj) {
var triggerId = $(event.target).attr("id"); //here you get the id of the object.
},