개발은 핵찜이야/JQUERY

[JQuery] Ajax load

주인정 2012. 7. 5. 15:27

<html>

    <head>

        <title>jquery </title>

        <script type="text/javascript" src="jquery.js"></script>

        

        <script type="text/javascript">

            

            $(document).ready(function(){

    

//get() AJAX 요청을 사용하여 서버에서 데이터, 지정된 요소로 자리 반환된 데이터

                $.get('content.php', function(data){ 

                    $('#content').html(data);

                });


            //load() AJAX 요청을 사용하여 서버에서 데이터, 지정된 요소로 반환된 데이터

                $('#button').click(function(){

                    $('#content').load('content.php #OTHER');

                });

                

            });

    </script>

    </head>

    <body>

        <h1>Ajax Load</h1>

        <div id="content">

            

        </div>

        

        <input type="submit" id="button" value="button">

        

    </body>

</html>