jquery ajax发送delete(use in jquery file upload delete file)
环境:
HTML example code
- <div class="pic-preview">
- <div class="pic"></div>
- </div>
- <div class="pic-action">
- <span class="btn btn-success fileinput-button">
- <i class="glyphicon glyphicon-plus"></i>
- <span>上傳圖片</span>
- <!-- The file input field used as target for the file upload widget -->
- <input id="fileupload" type="file" name="files[]">
- </span>
- </div>
- <div id="progress" class="progress">
- <div class="progress-bar progress-bar-success"></div>
- </div>
- <input type="hidden" name="pic" id="pic" value="">
Javascript:
- (function(){
- $(function(){
- //init fileupload
- $('#progress').hide();
- var url = '<?php echo $dn.'Uploader.php';?>';
- $('#fileupload').fileupload({
- url: url,
- dataType: 'json',
- done: function (e, data) {
- $.each(data.result.files, function (index, file) {
- $(".pic").empty().append('<img src="'+file.thumbnailUrl+'">');
- $("#pic").val(file.name);
- $(".pic-action").append('<span class="btn btn-danger" data-type="'+file.delete_type+'" data-url="'+file.deleteUrl+'" onclick="removePic(this)" >刪除</span>');
- });
- $('#progress').hide();
- },
- progressall: function (e, data) {
- $('#progress').show();
- var progress = parseInt(data.loaded / data.total * 100, 10);
- $('#progress .progress-bar').css(
- 'width',
- progress + '%'
- );
- }
- }).prop('disabled', !$.support.fileInput)
- .parent().addClass($.support.fileInput ? undefined : 'disabled');
- });
- })();
最终效果是:
参考链接: How to send a PUT/DELETE request in jQuery?
jquery ajax发送delete(use in jquery file upload delete file)的更多相关文章
- JQuery Ajax 发送请求成功后却接收不到任何响应数据问题
问题描述 使用 JQuery Ajax 向后端服务器发送请求,服务器也收到请求返回了响应数据,但是 Ajax 却收不到任何响应数据. 举例如下: $.ajax({ type: "post&q ...
- asp.net mvc 接收jquery ajax发送的数组对象
<script type="text/javascript"> $(function () { var obj = { name: "军需品", m ...
- jQuery.ajax发送image请求格式
1\请求端 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head run ...
- jQuery file upload --Multiple File Input Fields in One Form
The plugin can be applied to a form with multiple file input fields out of the box. The files are se ...
- jQuery.ajax() 函数详解
jQuery.ajax()函数用于通过后台HTTP请求加载远程数据. jQuery.ajax()函数是jQuery封装的AJAX技术实现,通过该函数,我们无需刷新当前页面即可获取远程服务器上的数据. ...
- jquery ajax 保存讲解
jquery ajax 参数传递与数据保存实例是一款适合于初学者用的,首先我们是讲一下关于如何利用ajax +php进行数据操作,然后再详细的介绍关于jquery ajax的帮助说明. jquery ...
- jquery.ajax()详解
jQuery.ajax() 函数详解 traditional 如果你希望使用传统方式来序列化参数,将该属性设为true. 传递数组时, traditional必须为true var arr = []; ...
- Java程序员之JS(一) 之 JQuery.ajax
背景:紧着现在项目的需要,先从JQuery.ajax出发,主要需求是通过 js 调用Java 代码,从而适应现在的项目. 先从几个概念开始讲解: 一. 什么是Deferred Deferred 对象 ...
- 原生Ajax--XmlHttpRequest对象和jQuery.ajax()
Ajax主要就是使用 [XmlHttpRequest]对象来完成请求的操作,该对象在主流浏览器中均存在(除早起的IE) 1.XmlHttpRequest对象介绍 XmlHttpRequest对象的主要 ...
随机推荐
- OpenStack Swift client开发
如果你搭建好了Swift环境 ,你应该可以通过Swift 命令 来尝试去测试上传下载等功能,这是因为在安装Swift的时候,通常会安装一个python-swiftclient客户端,这个一个pytho ...
- vs2013下git的使用
一.将VS2013项目托管到Git 现在的开源项目越来越多,我们会注意到这些开源项目大多共享在GitHub上面,包括微软开源的项目也在Github上,当然,如果你用过Git后,会发现Git确实不错,其 ...
- Matlab GUI界面
做SVD的时候,看学姐的demo,用到了matlab的GUI,感兴趣就自己学了一下: 从简单的例子说起吧. 创建Matlab GUI界面通常有两种方式: 1,使用 .m 文件直接动态添加控件 ...
- git ssh key for github
第一:检查.ssh是否存在(ls -al ~/.ssh) $ ls -al ~/.ssh Lists the files in your .ssh directory, if they exist 第 ...
- linux下ssh使用rsa验证登陆MACOX
由于项目的需求,我这边ubuntu下常常需要SSH访问另外一台MACOS. 每次输入密码有点烦,就想到RSA公钥和密钥验证的方法. 像所有教程上讲的一样,本机执行 gong@hzsx:~$ ssh-k ...
- 引爆公式让你的APP游戏成为下一个“爆款”
在2014年的移动互联网领域,“魔漫相机”是一款值得关注的产品.虽然没有腾讯.百度或阿里巴巴等大资源的支持,但是这款应用一上线就在中国市场发展迅猛,日下载量超过80万次,最高一日达300万次.类似的成 ...
- 射频识别技术漫谈(8)——动物标签【worldsing笔记】
动物标签也是工作在TTF模式的ID(Identification)卡.之所以通常称为动物标签,估计是因为一来和识别人的ID卡相区分,二是因为动物不如人听话,人的ID卡可以做成卡片形状拿在手上,而动物不 ...
- support-v4不能查看源码
在Android实际开发过程中往往会遇到使用v4,v7或v13兼容包中的一些类如ViewPager,Fargment等,但却无法关联源码 具体步骤: 1 右击Android项目中libs文件夹下的an ...
- ThindPad x230 无法U盘启动
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- AVAudioRecorder、AVAudioPlayer录音及播放
#pragma mark - 设置录制的音频文件的位置 - (NSString *)audioRecordingPath{ NSString *str_date=[TimeTransform Date ...