1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- var xmlHttpRequest = null;
- var AwtResult = null;
- //Awt ajax통신 객체 생성
- function xmlHttpPost()
- {
- //IE인경우
- if(window.ActiveXObject)
- {
- xmlHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');
- }
- else
- {
- alert("Err");
- }
- }
- //Awt서버에 보낼 구문 패턴을 만드는 함수
- function XMLPattern(strSpell, strFlag, searchCount)
- {
- var strXML = null;
- if (searchCount == null)
- strXML = encodeURI("strSpell="+strSpell+"&strFlag="+strFlag);
- else
- strXML = encodeURI("strSpell="+strSpell+"&strFlag="+strFlag +"&searchCount=" + searchCount);
- return strXML;
- }
- //Awt서버에 ajax요청을 보내는 함수
- function send(AwtAjaxUrl, strSpell, strFlag, searchCount)
- {
- var strPostValue=XMLPattern(strSpell,strFlag,searchCount);
- xmlHttpRequest.open('POST', AwtAjaxUrl, true);
- xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
- xmlHttpRequest.setRequestHeader("Cache-Control", "no-cache");
- xmlHttpRequest.setRequestHeader("Pragma", "no-cache");
- xmlHttpRequest.onreadystatechange = function() {
- if(xmlHttpRequest.readyState == 4)
- {
- switch (xmlHttpRequest.status)
- {
- case 404:
- //alert('오류: ' + AwtAjaxUrl + '이 존재하지 않음');
- break;
- case 200:
- OnResult(xmlHttpRequest.responseText.trim());
- break;
- default:
- //alert('오류: ' + xmlHttpRequest.responseText);
- break;
- }
- }
- }
-
- xmlHttpRequest.send(strPostValue);
- }
- String.prototype.trim = function ()
- {
- return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
- }
|