我使用uploadifyUpload()的处理其余部分来完成:等待uploadifyUpload()从这样的脚本中前脚本
$("#artist_form").validator({
offset: [0, 100],
position: 'center left',
messageClass: 'arterror'
}).submit(function(e) {
if (!e.isDefaultPrevented()) {
$('#file_upload').uploadifyUpload();
var form = $(this);
var serdata = form.serialize();
$.ajax({
type: "POST",
url: "sendartist.php",
data: serdata,
cache: false,
success: function (html) {
log('inside ajax artist', this, arguments);
if (html=="0") {
alert("An error occurred");
} else {
alert("Sent ok");
}
},
error: function (err) {
log('inside ajax artist', this, arguments);
}
});
e.preventDefault();
}
});
正如你所看到的,之前上传甚至有机会完成该表格已发送。这是不好的,因为我需要用'sendartist.php'中的上传文件做些什么来完成处理。
有没有办法为uploadifyUpload()添加某种回调,以便脚本只在它完成时才会继续?
干杯!
啊,我看它有点倒退。感谢fella! – 2012-02-09 18:27:33