$(function(){ MyInterestInsert.init(); }); var MyInterestInsert= { init : function(){ try { $('body').on('click', '.insert_interest_btn', MyInterestInsert.InsertInterest); } catch(e) { alert("[js/egovframework/tradekorea/www/myTradeKorea/myinterest_insert.js's MyInterestInsert.init] error : " + e.description); } }, InsertInterest : function(){ try { var l_result_type = $(this).attr('data-type'); //businessno & productno & buyingleadsno var l_result_val = $(this).attr('data-value'); //value if(l_result_type == '' && l_result_type == undefined && l_result_val == '' && l_result_val == undefined){ return; } var l_url = '/mytradekorea/myInterestSave.do'; var l_data = {'result_type' : l_result_type, 'result_val' : l_result_val}; // 검색 $.ajax({ url : l_url, type : 'POST', dataType : 'text', data : l_data, success : function(p_result) { var l_result = eval('('+p_result+')'); try { if(l_result.resultCode > 0){ Message.get(function(confirmMsg){ //interest has been registered. if(confirm(confirmMsg)) { //interest has been registered. if(l_result_type == "businessno"){ location.href = '/mytradekorea/myInterest.do'; }else if(l_result_type == "productno"){ location.href = '/mytradekorea/myInterestProduct.do'; }else if(l_result_type == "buyingleadsno"){ location.href = '/mytradekorea/myInterestBuyingleads.do'; } } },598); // if(confirm("Product of interest has been registered.")){ // if(l_result_type == "businessno"){ // location.href = '/mytradekorea/myInterest.do'; // }else if(l_result_type == "productno"){ // location.href = '/mytradekorea/myInterestProduct.do'; // }else if(l_result_type == "buyingleadsno"){ // location.href = '/mytradekorea/myInterestBuyingleads.do'; // } // } }else if(l_result.resultCode == -30000){ location.href = "/membership/login.do"; return; }else if(l_result.resultCode == -20002){ Message.get(function(confirmMsg){ //Same product already exists in your “My Interests” if(confirm(confirmMsg)) { if(l_result_type == "businessno"){ location.href = '/mytradekorea/myInterest.do'; }else if(l_result_type == "productno"){ location.href = '/mytradekorea/myInterestProduct.do'; }else if(l_result_type == "buyingleadsno"){ location.href = '/mytradekorea/myInterestBuyingleads.do'; } } },674); //해당 내용 변경 return ; }else{ Message.get(function(msg){ alert(msg); return false; },145); } } catch(e) { Message.get(function(msg){ alert(msg); },145); } }, error : function(p_xhr, p_status, p_error) { alert(p_error); } }); } catch(e) { alert("[js/egovframework/tradekorea/www/myTradeKorea/myinterest_insert.js's MyInterestInsert.InsertInterest] error : " + e.description); } } };