관리 메뉴

IT.FARMER

jQuery Ajax Sample ... 본문

JavaScript/jquery

jQuery Ajax Sample ...

아이티.파머 2011. 11. 18. 11:03
반응형
jQuery의 Ajax 호출 방식은 Prototype 과 유사, Attribute 가져오는것도 비슷. CSS는 아직,,
var CodeSetting = function(code , name){
this.settingOpenWindows(code , name);
};
CodeSetting.prototype = {
settingOpenWindows : function(code , name){
this.duplictionCheck(code, name);
//셋팅 됬으면 윈도우 종료
//this.closeWindow();
} ,
closeWindow : function(){
window.close();
},
duplictionCheck : function (code , name ){
var url = "/employ/summertimeManagement/duplictionCheck.hr";
$.ajax({
type : "get" ,//get or post
async : true, //true, false  비동기, 동기
url  :  url ,//Request UEL
data : {ab_code : code},//parameter $("#formid").serialize()
dataType :"json" , //전송받을 데이터 타입 xml, html, script json
                                                                  //등 미지정시 자동 판단
cache : false , //true, false  데이터 케시 여부 
contentType : "application/x-www-forn-urlencoded;charset=utf-8",
success : function (response, status, request){
if(response.result = 'SUCCESS'){
//alert(response.duplication);
if(response.duplication){//이미 있으면 true
alert('이미 등록된 코드가 있습니다. 다른 코드를 선택하십시요.');
}else {//등록 된게 없으면 false
opener.document.getElementById("subsidiary_code").value = code;
opener.document.getElementById("subsidiary_name").value = name;
}
}else {
alert('처리중 Error가 발생 하였습니다. /n/n 계속 발생 되면 관리자에게 문의 바랍니다.');
}
},
error : function(xmlHttpRequest, txtStatus, errorThrown) {
alert("errorMessage:["+ txtStatus+"] 에러가 계속 발생되면 관리자에게 문의 바랍니다." + xmlHttpRequest.responseText);
},
beforeSend : function(){// 통신 시작 할때 처리
$("#ajax_indicator").show();//.fadein('fast');
},
complete : function (){ //통신이 완료된 후에 처리
$("#ajax_indicator").hide();//.fadeOut();
//this.inputCode(code, name);
}
});
},
inputCode : function (code, name) {
}


반응형

'JavaScript > jquery' 카테고리의 다른 글

jQuery UI libary url Link  (0) 2011.11.30