jQuery添加URL参数

时间:2015-08-31 18:31:03

标签: javascript jquery dropzone.js

我使用dropzone.js有一个jquery多个拖放文件上传器。

我已将以下代码添加到dropzone代码

  this.on("queuecomplete", function (file) {
      alert("&success=yes");

  });

因此,当队列完成时,它会发送一个警报,但是我想要更改它,以便使用jquery将它作为参数添加到URL。

如何使用jquery做到这一点?

1 个答案:

答案 0 :(得分:16)

这将完成这项工作......

this.on("queuecomplete", function (file) {
var url = document.location.href+"&success=yes";
      document.location = url;
  });

选项二(如果您已有一个参数)

this.on("queuecomplete", function (file) {
    if(document.location.href.contains('?')) {
        var url = document.location.href+"&success=yes";
    }else{
        var url = document.location.href+"?success=yes";
    }
      document.location = url;
  });
相关问题