zoukankan      html  css  js  c++  java
  • ajax+php (jquery.form插件)实现异步文件上传

    <!DOCTYPE html>
    <html lang="CN">
    <head>
    	<title>upload model</title>
    	<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
    	<script type="text/javascript" src="js/jquery.min.js"></script>
    	<script type="text/javascript" src="js/jquery.form.js"></script>
    </head>
    <body>
        <label>Filename:</label>
        <form id="form" action="upload_file.php" method="post" enctype="multipart/form-data">
    		<input type="file" name="file" id="file" /> 
    		<input type="button" value="Upload" name="button" id="button"></button>
        </form>
    
    	<script type="text/javascript">
    	    $(document).ready(function () {
    	    	var options = {
    	    		success: function (data) {
    	    			$("#responseText").text(data)  //responseTest没实际意义
    	    		}
    	    	};
    	    	$("#button").click(function () {
    	    		$("#form").ajaxSubmit(options);
    	    	});
    	    });
    	</script>
    </body>
    </html>
    

     注意,Jquery最低版本为v1.5

    参考:http://www.cnblogs.com/heyuquan/p/form-plug-async-submit.html

  • 相关阅读:
    PowerMockito
    java--树封装
    plugin--Lombok
    Mysql--sql
    Oracle--sql
    hive--分区表和分桶表
    hive支持的数据类型和存储格式
    HashMap
    golang 创建 tun 设备
    golang ctrie demo
  • 原文地址:https://www.cnblogs.com/yxpblog/p/5113180.html
Copyright © 2011-2022 走看看