<script type=
"text/javascript"
>
$(
function
() {
var
button = $('#upload');
new
AjaxUpload(button, {
action: '/upload/imagesAjaxUpload',
name: 'upload',
onSubmit:
function
(file, ext) {
if
(!(ext && /^(jpg|jpeg|JPG|JPEG)$/.test(ext))) {
alert('图片格式不正确,请选择 jpg 格式的文件!', '系统提示');
return
false;
}
button.text('上传中');
this.disable();
interval = window.setInterval(
function
() {
var
text = button.text();
if
(text.length < 10) {
button.text(text + '...');
}
else
{
button.text('上传中');
}
}, 200);
},
onComplete:
function
(file, response) {
window.clearInterval(interval);
this.enable();
var
json =
eval
('(' + response + ')');
button.text('选择文件');
$(
".qr"
).css(
"display"
,
"inline"
);
$(
".qr>img"
).attr(
"src"
,json.file_name);
$(
"input[name='wechat_qr']"
).val('/uploads/qr/'+json.file_name);
}
});
});
</script>