AJAX (Asynchronous Javascript And XML)¸¦ °øºÎ Çϱâ À§ÇØ ÇÊ¿äÇÑ HTML°ú jquery
±âº»¿¡ ´ëÇؼ ¾Ë¾Æ º»´Ù. AJAX¸¦ »ç¿ëÇϱâ À§ÇÑ Çʼö HTML Äڵ带 »¡°£»ö º¼µå·Î Ç¥½Ã ÇÏ¿´´Ù. <!DOCTYPE html>
<html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <div id="ptest1"> <p>kimchulsu</p> </div> <p id="ptest2">hello.</p> <input type="button" name="btn-test" id="btn-test" value="¸¶À̹öÆ° Å×½ºÆ®" /> <script type="text/javascript"> $("#ptest1").html("<h2>³ª¾ß³ª.</h2>"); $("#ptest2").text("mymy"); $("#btn-test").on("click", function () { do_test(); console.log("objs=", objs); }); function do_test(){ alert("btn-test Ŭ¸¯"); } </script> </body> </html> jqery ÀÓÆ÷Æ® Çϱâ<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>¹öÆ° Ãß°¡html¿¡¼´Â ´ÙÀ½°ú °°ÀÌ Ãß°¡ ÇÑ´Ù.<input type="button" name="btn-test" id="btn-test" value="¸¶À̹öÆ° Å×½ºÆ®" /> jquery ÄÚµå´Â ´ÙÀ½°ú °°ÀÌ Ãß°¡ ÇÑ´Ù. $("#btn-test").on("click", function () { do_test(); console.log("objs=", objs); }); function do_test(){ alert("btn-test Ŭ¸¯"); } .html() ¸Þ¼ÒµåÇØ´ç ¿ä¼ÒÀÇ ³»¿ëÀ» ¹ÝȯÇϰųª ¿ä¼Ò³»ÀÇ ³»¿ëÀ» º¯°æÇÑ´Ù.º¯°æÀü html ÄÚµå <div id="ptest1"> <p>kimchulsu</p> </div> jquery ÄÚµå $("#ptest1").html("<h2>³ª¾ß³ª.</h2>"); º¯°æÈÄ html ÄÚµå <div id="ptest1"> <h2>³ª¾ß ³ª.</h2> </div> .text() ¸Þ¼ÒµåÇØ´ç ¿ä¼ÒÀÇ ³»¿ëÀ» º¯°æÇÑ´Ù.º¯°æÀü html ÄÚµå <p id="ptest2">hello.</p> jquery ÄÚµå $("#ptest2").text("mymy"); º¯°æÈÄ html ÄÚµå <p id="ptest2">mymy</p> Âü°í) .html() , .text() ¸Þ¼Òµå https: //www.devkuma.com/docs/jquery/¿ä¼ÒÀÇ-³»ºÎ-º¯°æ-html--text-/ ¿ä¼Ò³»ÀÇ html ÄÚµå º¯°æ .html() ÀÚ¼¼ÇÏ°Ô ¼³¸í https: //bskyvision.com/entry/jquery-html-¸Þ¼µå Ajax¸¦ Ç°Àº jQuery https://www.nextree.co.kr/p4771/ |