$.ajax({ type: "POST",//전송방식 GET,POST url: "전송할 페이지 URL", data: {name : "value" , name2 : "value2"},//파라미터 전송 dataType: "xml",//페이지 리턴 형식 json, jsonp, xml, html async: false, //동기식 = false , 비동기식 = true // 기본값 true success: function(xml){ //아작스 전송 성공시 실행 스크립트 //$("#contents").html(xml); }, beforeSend : function(){// 아작스 전송전 실행 스크립트 $("#nation_content_view").showLoading(); }, complete : function(){//아작스 작업 완료후 실행 스크립트 $("#nation_content_view").hideLoading(); }, error: function(xhr, status, error){ // 아작스 에러 발생시 실행 스크립트 alert("에러 : " + error); } });
jQuery 아작스 틀
그중 success 부분을 아래와 같이 처리
if( $(xml).find("result_size").text() > 0 ){ //반복문으로 파일 표시 $(xml).find("record").each(function(){ var path = $(this).find("PATH").text(); var name = $(this).find("NAME").text(); var view = $(this).find("VIEW").text(); }); }