알이즈웰

jQuery.ajaxSettings.traditional = true; 본문

Programming/Front-End

jQuery.ajaxSettings.traditional = true;

2017. 6. 26. 08:51

jQuery로 ajax 통신 처리 시 데이터를 배열로 넘겨줄 때 설정한 것


jQuery.ajaxSettings.traditional = true;


//저장 function save(){ if(siteChk()){ var url = "/uems/mng/trendMng/trendMngSaveAjax.do"; trendGroupList = []; var trendTagList = []; $("#trendGroupList").children().each(function(){ trendGroupList.push($(this).text()); }); $("#tagList").children().each(function(){ trendTagList.push($(this).attr("id")); }); var siteId = $("select[name=searchCondition] option:selected").val(); var tgId = $(".devTrendGroup").text(); jQuery.ajaxSettings.traditional = true; $.ajax({ url: url, type: "POST", data: {trendGroupList:trendGroupList, siteId:siteId, trendTagList:trendTagList, tgId:tgId}, dataType: "json", async:false }).done (function(data) { if(data.result){ alert("저장하였습니다."); }else{ alert("실패하였습니다."); } }); } }


[참고]

http://yangyag.tistory.com/141

http://findfun.tistory.com/399

http://api.jquery.com/jQuery.ajax/

Comments