DWZ 在js中刷新某个navTab
当时的想法是:
上传一个文件成功后 刷新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()); } }