zoukankan      html  css  js  c++  java
  • ajax 假上传文件

    1.

    <form name="certForm" id="certForm" method="post" action="xxx.htm" enctype="multipart/form-data" target="uploadCertIframe">
    <table>
    <tr>
    <td class="ft-right" width="10%"><font color="red">* </font>选择你要上传的证书文件</td>
    <td width="15%">
    <input type="file" id="certFile" name="certFile"/>
    </td>
    <input type="text" class="i-text" size="27" name="password" id="password" value="$!certForm.password"/></td>
    </td>
    </tr>
    </table>

    <div class="tb-tfoot tb-tfoot-noborder">
    <span class="btn"><input type="submit" value="提交" onclick="return submitCheck()"></span>
    </div>
    </form>
    form.target属性指定表单提交的页面 就是以下的iframe  的名字 ,后端处理结果页面如vm返回到此iframe 中,然后做页面跳转,产生类似异步提交的错觉。

    2.

    <iframe style="display:none" name="uploadCertIframe" id="uploadCertIframe"></iframe>

    3.

    @RequestMapping(value = "xxx.htm", method = RequestMethod.POST)
    public String createxxxByImport(ModelMap modelMap, WebRequest request, xxxForm xxxForm) {


    modelMap.addAttribute("xxx", xxxxForm.getxxxAlias());

    return "xxx.vm";
    }

    4.xxx.vm js处理  注:要操作iframe 上面的页面得用parent来操作

    <div id = "result">$!result</div>
    <script type="text/javascript">
    var result = $("#result").text();
    if(result == "T"){
    window.parent.$(".tip-success").show();
    setTimeout(function(){
    parent.document.location.href ='/xx/xxManage.htm?xxx='+xxx;
    },3000);
    }
    </script>

  • 相关阅读:
    链串
    一个外行谈行业应用的营销问题
    SharePoint 2013的100个新功能之场管理
    Deep Learning and Shallow Learning
    [IOS]UIWebView 请求网络页面或者加载本地资源页面
    九度OJ 打印日期 (模拟)
    STM32学习之路-SysTick的应用(时间延迟)
    box-shadow
    让算法会说话之高速排序
    A5-1和DES两个加密算法的学习
  • 原文地址:https://www.cnblogs.com/lanGuo/p/4240531.html
Copyright © 2011-2022 走看看