관리 메뉴

moozi

ajax04.html 본문

TIS_2017/응용sw_2기

ajax04.html

moozi 2017. 8. 18. 10:35

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>Ajax - jQuery, json</title>

    <!-- jQuery -------------------------------->

    <script

    src="https://code.jquery.com/jquery-1.12.4.min.js"

    ></script>

    <script>

        $(document).ready(function(){

            $.getJSON('data.json',function(data){

                $.each(data,function(key,value){

                    $("#drink").append("<h1>"+value.name+"</h1>");

                    $("#drink").append("<h3>"+value.price+"</h3>");

                });

            });

        });

    </script>

</head>

<body>

    <div id="drink"></div>

</body>

</html>

'TIS_2017 > 응용sw_2기' 카테고리의 다른 글

jsp연습문제01  (0) 2017.08.21
ajax연습문제02  (0) 2017.08.18
반응형웹 미니프로젝트  (0) 2017.08.17
ajax연습문제01  (0) 2017.08.17
8/16 bmw  (0) 2017.08.16
Comments