j쿼리 ajax

j쿼리 ajax

<html>

<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js“></script>

</head>

<body>

<p>Result : <span id=”time”></span></p>

<script>

$(document).ready(function(){

    var xhr = new XMLHttpRequest();

    xhr.open(‘GET’, ‘./call_url.jsp’);

    xhr.onreadystatechange = function(){

        if(xhr.readyState === 4 && xhr.status === 200){ 

            //$(‘#time’).html(decodeURIComponent(xhr.responseText));

        $(‘#time’).text(xhr.responseText);

        }

    }

    xhr.send();

});

</script>

</body>

</html>