【问题标题】:Redirect user after all files finished uploading所有文件上传完成后重定向用户
【发布时间】:2014-11-03 01:06:59
【问题描述】:

我正在使用带有 Carrierwave 的 jQuery-File-Upload 来上传多个文件。我正在上传多个文件,并希望在上传所有文件后重定向用户。这就是我现在的做法:

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 + '%')

目前我只是在同一页面上显示所有进度条,上传所有文件后我仍在同一页面上。我如何知道所有文件何时上传,以便将用户重定向到另一个页面?谢谢:)

【问题讨论】:

标签: jquery ruby-on-rails ajax jquery-file-upload


【解决方案1】:
completed: function(e, data) {
  //redirect in here
}

Blueimp API - fileupload options

【讨论】:

    猜你喜欢
    • 2012-07-28
    • 2020-04-08
    • 1970-01-01
    • 1970-01-01
    • 2013-03-06
    • 2013-10-30
    • 2019-07-18
    • 2012-05-20
    • 1970-01-01
    相关资源
    最近更新 更多