js 回调

来源:互联网 发布:mac上铃声软件 编辑:程序博客网 时间:2024/05/19 01:11
//根据单子id查询所有图片
function queryPhotoByMainId(mainId,showMinusOrNot){
        showMinus=showMinusOrNot;
         var jsonData = "{" + "\"mainId" + "\":" + "\"" + mainId+"\"" +"}";
         searchPictures(photoSaveUrl,jsonData,afterQueryComplete);  
}

//查询单子id成功后的回调函数
function afterQueryComplete(photoInformation){
     var c = $("#zgzc-photo-container");
     c.html("");
     var photoStr="";
     if(photoInformation.statusCode=="200"){
         var difStr="";
         if(showMinus==1){
             difStr="<span class="+"\"d"+"\""+ " onclick="+"\"deletePhotoById(this) "+"\">"+"—</span></li>";
         }else{
             difStr="</li>";
         }
      $("#showOnePic img").attr("src",photoSaveUrl+photoInformation.pictureList[0].fileUrl);
      $("#showOnePic img").attr("class",photoInformation.pictureList[0].fileId);
      $("#showOnePic p").text(photoInformation.pictureList[0].fileName);
      $.each(photoInformation.pictureList, function(i, item) {
            photoStr="<li><img id="+"\""+item.fileId+"\""+
            " src="+"\""+photoSaveUrl+item.fileUrl+"\"" +"class="+"\""+item.fileName+"\"" +"onclick="+"\"showThePhoto(this)"+"\"" +"style="+"\"max-width: 100%; max-height: 100%; vertical-align: middle;"+"\""
            +"/>"+"<p>"+item.fileName+"</p>";
            photoStr+=difStr;
            c.append(photoStr);
            });
       }
}
原创粉丝点击