我正在尝试通过dropzone发出一个AJAX请求,但它一直给我一个错误No URL provided.
这个AJAX请求在我的输入字段中工作但是当我尝试将它插入我的dropzone时它没有工作
<div class="dropzone" id ="drop">
<div class="fallback">
<input type="file" id="files" name="files[]" multiple></input>
</div>
</div>
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// files is a FileList of File objects
for (var i = 0, file_name; file_name = files[i]; i++) {
$.ajax({
url: 'https://content.dropboxapi.com/2/files/upload',
type: 'post',
data: file_name,
processData: false,
contentType: 'application/octet-stream',
headers: {
"Authorization": "Bearer ACCESS TOKEN",
"Dropbox-API-Arg": '{"path": "/' + file_name.name + '","mode": "add"}'
},
success: function (data) {
alert('Success Upload');
console.log(data);
},
error: function (data) {
console.log(data);
}
})
}
}
document.getElementById('files').addEventListener('change', handleFileSelect, false);
如何调用AJAX请求?