Jquery 在所有文件完成上载后重定向用户
我使用带有Carrierwave的jQuery文件上载进行多文件上载。我正在上载多个文件,并希望在所有文件上载后重定向用户。我现在就是这样做的:Jquery 在所有文件完成上载后重定向用户,jquery,ruby-on-rails,ajax,jquery-file-upload,Jquery,Ruby On Rails,Ajax,Jquery File Upload,我使用带有Carrierwave的jQuery文件上载进行多文件上载。我正在上载多个文件,并希望在所有文件上载后重定向用户。我现在就是这样做的: jQuery -> $('#new_update').fileupload dataType: "script" add: (e, data) -> types = /(\.|\/)(gif|jpe?g|png)$/i file = data.files[0] if types.tes
jQuery ->
$('#new_update').fileupload
dataType: "script"
add: (e, data) ->
types = /(\.|\/)(gif|jpe?g|png)$/i
file = data.files[0]
if types.test(file.type) || types.test(file.name)
data.context = $(tmpl("template-upload", file))
$('#new_update').append(data.context)
else
alert("#{file.name} is not a gif, jpeg, or png image file")
$("#submit_button").on 'click', ->
data.submit()
progress: (e, data) ->
if data.context
progress = parseInt(data.loaded / data.total * 100, 10)
data.context.find('.bar').css('width', progress + '%')
目前,我只是在同一页上显示所有进度条,所有文件上传后,我仍然在同一页上。我如何知道何时上载所有文件,以便将用户重定向到其他页面?谢谢:)
这可能会有所帮助
completed: function(e, data) {
//redirect in here
}