11/15/2022

전자정부프레임워크 New Web Project, New Boot Web Project

차이점.

New Web Project.

New Boot Web Project. 

 



XMLHttpRequest JSON.parser 정리

>>ajax사용하는 방법 또는 XMLHttpRequest자바스크립트를 사용/

 

var xhr = new XMLHttpRequest();
            //xhr.responseType = 'json';
            xhr.open("GET", "t_01_01.do", true);
            xhr.onload = function () {

                if (this.readyState === 4 && this.status == 200)
                {
                    // status 는 HTTP 통신의 결과를 의미
                    // 200 은 통신이 성공했다는 뜻
                    console.log(this.responseType);  // 요청 반환 jsp 의 정확한 처리 필요.
                    console.log("succ... response Text [" + this.responseText  + "]"    );
                    //document.getElementById("result").innerHTML = this.responseText;
                    //var ob = jQuery.parseJSON(this.responseText);
                    //console.log(ob);
                    //var tempArr =
                    <%
                    //=helloWorld(<script> this.responseText </script>);
                    %>
                    var jjj = JSON.parse(this.responseText);  // json 파싱.

                    var tempArr = [];
                    tempArr[0] = jjj[0]['n1'];
                    tempArr[1] = jjj[0]['n2'];
                    tempArr[2] = jjj[0]['n3'];
                          draw_refresh( tempArr );

            }