Note that if the resulting record is converted to an object or JSON, virtuals are not included by default. Pass virtuals : true to either toObject() or to toJSON() to have them returned.
var list = document.getElementById("list"); for (var i = 1; i <= 5; i++) { var item = document.createElement("li"); item.appendChild(document.createTextNode("列表 " + i));
item.onclick = function (e) { console.log("列表 " + i + " 被点击."); }; list.appendChild(item); }
var $input = $('#upload-qiniu'); var token = 'sMTdcnRxls_IaTJ1uSOR1Rb7zFkcdJq3LK0MPjR1:4k547QcZwzo2fK7zPJeu28UgXNM=:eyJzY29wZSI6Im9haGEiLCJkZWFkbGluZSI6MTQ0MTk2NzY1Mn0='; var url = 'http://up.qiniu.com/'; var prefix = 'http://7vii28.com1.z0.glb.clouddn.com/';
$input.on('change', function(){ var me = $(this); var file = this.files[0]; var formData = new FormData(), filename = file.name; formData.append('token', token); formData.append("file", file); $.ajax({ url : url, type : 'POST', data : formData, processData : false, // 对数据不作处理 contentType : false// 使用原始类型 }).done(function(json){ console.log(json); }).fail(function(json){ console.log(json.responseJSON.error); }); });