當時的想法是:
上傳一個文件成功后 刷新navTab ,關閉上傳文件dialog.
function fileNameBack(args){
//表單毀掉函數 alertMsg.correct(args["msg"],null); navTab.reloadFlag("main");//navTab的名稱 $.pdialog.closeCurrent(); }
<form action="" method="post" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return iframeCallback(this, fileNameBack)"> </form>
args是后台返回的json字符串:
后台方法
JSONObject resultJson = new JSONObject(); resultJson.put("msg","成功!"); context.sendAsString(resultJson.toString()); public void sendAsString(String s,String... encoding) { String charset = "UTF-8"; if(encoding.length==1){ charset = encoding[0]; } response.setContentType("text/html; charset="+charset); response.setHeader("Cache-control", "no-cache"); response.setCharacterEncoding(charset); try { response.getWriter().write(s); } catch (IOException e) { throw new RuntimeException("response write json error.info: " + e.getMessage()); } }