12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- var xmlHttpRequest = null;
- var AwtResult = null;
- function xmlHttpPost()
- {
- //IE인경우
- if(window.ActiveXObject)
- {
- xmlHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');
- }
- else
- {
- alert("Err");
- }
- }
- 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;
- }
- //function ReturnResult(responseText)
- //{
- // alert(responseText);
- //}
- 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');
- 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*$/, '');
- }
|