我需要在 dojo 中上传文件的完整代码。尤其是 ajax 调用及其按钮创建,其 url 必须存储到数据库中。我使用以下代码,但它不起作用:
function uploadPicture()
{
alert("yes");
var xhrArgs = {
url:"/service/ajax/uploadPictureToOption/",
form: dojo.byId("optionsForm"),
handleAs: "json",
content :{},
load: function(response, ioArgs){
if (response == "failed")
{
alert("Failed");
window.location.reload();
}
else if (response == "success")
{
window.location.reload();
}
else
{
alert("Successfully deleted");
window.location.reload();
}
},
}
var deferred = dojo.xhrPost(xhrArgs);
}