// 전역변수 선언됬는지 확인 맨위쪽 var productCategoryNum; var fabricCategoryNum; var categoryType; wv.setUploader 전부 주석이나 지우면될것같음. ----------------------------------------------------------------------------------------------------- 업로드 부분 $('.inp-file-fabric').on('change', function() { // deleteCookie(변수이름) alert(fabricCategoryNum); alert(productCategoryNum); alert(categoryType); if(categoryType=='product'){ alert('Fabric tab에서 올려주시기 바랍니다.'); }else if(categoryType=='fabric'){ var formData = new FormData($("#uploadForm")[0]); $('#uploadForm')[0].reset(); formData.append('Type', 'true'); formData.append('CID', fabricCategoryNum); console.log(formData); $.ajax({ url: '/manager/fabric/create', type: 'POST', data: formData, contentType: false, processData: false, success: function (id, filename, response) { if (response['success']) { alert('Fabric을 추가하셨습니다.'); wv.getFabricList(cid); } else { switch (response['reason']) { case 'Anonymous': alert('please login first'); break; case 'NoCategory': alert('none of categories selected.'); console.log('none of categories selected.'); break; default: alert('please login or select a fabric category.'); return false; break; } } $('#uploadForm')[0].reset(); } }); } }); ----------------------------------------------------------------------------------------init main category menu 쪽 // 메인 카테고리 메뉴 클릭 이벤트 초기화 wv.initMainCategoryMenu = (function() { var selectMainCategory; $('.TopNav>ul>li').click(function() { selectMainCategory = $(this).text().toLowerCase(); var cate = selectMainCategory.replace(/\s/gi,""); if (wv.state.activeCategory === selectMainCategory) { return false; } $(this).siblings().removeClass('selected'); $(this).addClass('selected'); wv.state.activeCategory = selectMainCategory; // wv.initUploadBtn(selectMainCategory); if(cate=="product") { wv.getProductList((productCategoryNum == null ? 10 : productCategoryNum)); // console.log("productCategoryNum"+productCategoryNum); // wv.setUploader(cate,productCategoryNum); categoryType = cate; //카테고리 추가 } else { if(fabricCategoryNum == null){ wv.setCategory(cate); } wv.getFabricList((fabricCategoryNum == null ? 24 : fabricCategoryNum)); // console.log("fabricCategoryNum"+fabricCategoryNum); // wv.setUploader('fabric',fabricCategoryNum); categoryType = cate; //카테고리 추가 } // $(".current-gnb."+cate).empty(); // $('.dropdown-menu.' +cate+ '> li > ul').empty(); // wv.setCategory(cate); }); })(); --------------------------------------------------------------------------------------------selectchuildcategory wv.selectChildCategory = function(type, $childCategory, categoryId) { // $('.sideNavAcco > li > ul > li').removeClass('selected'); // $childCategory.addClass('selected'); categoryIdW = categoryId; // wv.state.selectCategory[type].lev2idx = $childCategory.index(); if (type === "product") { wv.getProductList(categoryId); // wv.setUploader(type,categoryId); } else if (type === "fabric") { wv.getFabricList(categoryId); fabricCategoryNum = categoryId; // 카테고리 아이디값 } };