Created
May 31, 2013 07:25
-
-
Save PizzaLiu/5683397 to your computer and use it in GitHub Desktop.
AjaxFileUploader 2.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="./static/js/jquery-1.6.4.min.js"></script> | |
<script type="text/javascript" src="./static/js/ajaxfileupload.js"></script> | |
<input name="pic" id="pic" type="file" /> | |
function ajaxFileUpload(){ | |
jq('input[name="pic"]') | |
.ajaxStart(function(){ | |
jq('span.pic-up-notice').html('<img src="./static/image/common/loading.gif" />图片上传ing...'); | |
}) | |
.ajaxComplete(function(){ | |
jq('span.pic-up-notice').html('图片上传完成!<a class="reedit-pic" href="#">修改图片</a>'); | |
}); | |
jq.ajaxFileUpload | |
( | |
{ | |
url:'./home.php?mod=spacecp&ac=plugin&id=tv_prom:tv_prom_admin&act=pic_admin&upfile=pic', | |
secureuri:false, | |
fileElementId:'pic', | |
dataType: 'json', | |
data:{pizza:'liu'}, | |
success: function (data, status){ | |
if(typeof(data.error) != 'undefined'){ | |
if(data.error != ''){ | |
alert(data.error); | |
}else{ | |
//alert(data.msg); | |
jq('.show_pic').css('background-image','url('+data.msg+')'); | |
jq('input[name="picx"]').val(data.msg); | |
} | |
} | |
}, | |
error: function (data, status, e){ | |
alert(e); | |
} | |
} | |
) | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment