$('#picbutton').click(function () { $("#fileToUpload").click(); }); $(document).on("click", ".rmattch", function () { var divRm = $(this).attr('rel'); $("." + divRm).remove(); }); /*################################# Upload Pic #######################*/ function ajaxFileUpload(masterkey) { var valPathUp = jQuery("input#pathUp").val(); var valuepicname = jQuery("input#picname").val(); //$("#keyPage").val("load"); // $("#addPicbox").last(''); $("#addPicbox").append('
'); jQuery.ajaxFileUpload({ //url: 'loadInsertPic.php?myID=' + id + '&masterkey=' + masterkey + '&langt=' + txtlang , url: ''+valPathUp+'th/upload?type=board&masterkey=' + masterkey + '', secureuri: false, fileElementId: 'fileToUpload', dataType: 'json', success: function (data, status) { var fileadd = '' if (data.error) { alert(data.error); $(".loadboardaddfile").remove(); } else { $.each(data.listpic, function (i, item) { fileadd += '
'; if (data.listtype[i] == "pdf") { fileadd += '
'; } else { fileadd += '
'; } fileadd += ''; fileadd += '
'; fileadd += '
'; }); $(".loadboardaddfile").remove(); $("#addPicbox").append(fileadd); } }, error: function (data, status, e) { alert(e); } }); return false; }