![](/img/trans.png)
[英]Function objects in Smalltalk (or executing blocks with no `value:`)
[英]Executing Script after serializeFileUpload
我不知道是否可能,但我喜歡在將其上傳到圖書館后顯示圖片。 一旦我想級聯serializeFileUpload我得到一個錯誤,方法注釋也聲明serializeFileUpload可能是唯一的回調。 我的代碼到目前為止:
html fileUpload
...
id: #fileUpload;
onChange: (html jQuery ajax
serializeFileUpload: (html jQuery id: inputString ));
callback: [ :f | self handleNewFile: f]
有沒有辦法讓jQuery用上傳的圖像替換#fileUpload?
謝謝
馬克斯
在JQAjax中實現>> serializeFileUpload:aQuery
self
data:
((((JSStream on: 'var formdata = new FormData()'),
((aQuery copy attributeAt: 'name') assignLocalTo: 'name'),
(((aQuery property: 0) access: 'files') assignLocalTo: 'files'),
(JSStream on:'for(i=0;i<files.length;i++) formdata.append(name,files[i])'),
(JSStream on: 'return formdata')) asFunction) apply: #());
url: self renderContext actionUrl;
type: 'POST';
cache: false;
processData: false;
contentType: false
你試過使用ajax onsucces回調嗎?
(html jQuery ajax
...
onSuccess: ((html jQuery id: #fileUpload) replaceWith: [:r | ... ]))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.