jquery html5 上传图片并且 图片回显
2015-06-03 15:09
537 查看
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <script type="text/javascript" src="jquery-2.1.4.min.js"></script> <script type="text/javascript"> $(function(){ var fil=$("#fil"); $("<img>").insertAfter("input"); fil.bind('change',function(){ var fordate=new FormData(); var fils=$("#fil").get(0).files[0]; fordate.append('pic',fils); var srcc=window.URL.createObjectURL(fils); console.log(srcc); $("img").attr({'src':srcc,'width':500+'px','heigth':500+'px'}); $.ajax({ url: "index4.php", type: "post", data: fordate, processData : false, contentType : false, success: function(html){ console.log(html); } }); }); }); </script> </head> <body> <input type="file" id="fil"> </body>
相关文章推荐
- jquery实现checkbox复选框的全选反选
- jQuery学习笔记3--网页字体变大变小
- 用户注册验证_基于jquery validate
- $.grep ,$.map,jquery筛选数组之grep、each、inArray、map的用法及遍历json对象
- jquery页面刷新
- jquery qrcode二维码生成插件
- jQuery中extend()和fn.extend()方法详解
- jquery中添加属性和删除属性
- jQuery事件绑定on()、bind()与delegate() 方法详解
- jquery 防止按钮二次点击
- jQuery插件jqplot的详细配置说明和渲染器
- jquery选择器,逗号
- Jquery 获取CheckBoxList 中选择的值和获取RadioButton 选中的状态
- jquery抖动的按钮
- CSS选择器与jQuery选择器的异同:一些特殊的选择器
- jquery delegate
- springMVC框架下JQuery传递并解析Json数据
- Jquery绑定事件(bind和live的区别)
- jQuery on, live,bind 等方法通过参数 data 传值给 function
- Cordova+jQuery Mobile+Spring REST