Ajaxは非同期通信、サーバー側からページの更新なく情報を読み出す技術です。
index.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <! DOCTYPE html> < html lang = "ja" > < head > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title >jQeury</ title > < style > .myStyle{ border:5px solid green; font-size:48px; } </ style > < link rel = "stylesheet" href = "styles.css" > </ head > < body > < p >jQueryの練習</ p > < button >もっと読む</ button > < div id = "result" ></ div > < script > $(function(){ $('button').click(function(){ $('#result').load('more.html'); }); }); </ script > </ body > </ html > |
more.html
1 | < p id = "message" >メッセージです!</ p > |