.load( url, [data,] [complete(responseText, textStatus, XMLHttpRequest)] )
<html> <head> <title>ThaiCreate.Com jQuery Tutorials</title> <style> body{ font-size: 12px; font-family: Arial; } </style> <script type="text/javascript" src="jquery-1.6.4.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#new-nav").load("#jq-footerNavigation li"); }); </script> </head> <body> <b>Footer navigation:</b> <ol id="new-nav"></ol> <hr/> <div id="jq-footerNavigation"> <ul> <li class="jq-download jq-first"><a href="http://docs.jquery.com/Downloading_jQuery">Download</a></li> <li class="jq-documentation"><a href="http://docs.jquery.com">Documentation</a></li> <li class="jq-tutorials"><a href="http://docs.jquery.com/Tutorials">Tutorials</a></li> <li class="jq-bugTracker"><a href="http://dev.jquery.com/">Bug Tracker</a></li> <li class="jq-discussion jq-last"><a href="http://docs.jquery.com/Discussion">Discussion</a></li> </ul> </div> </body> </html>
<html> <head> <title>ThaiCreate.Com jQuery Tutorials</title> <style> body{ font-size: 12px; font-family: Arial; } </style> <script type="text/javascript" src="jquery-1.6.4.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#btn1").click(function(){ $("#div1").load('jQueryload2.php'); $("#div2").load('mytext.txt'); }); }); </script> </head> <body> <div id="div1"></div> <div id="div2"></div> <input type="button" id="btn1" value="Load"> </body> </html>
<?php echo "Now time = ".date("Y-m-d H:i:s"); ?>
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
<html> <head> <title>ThaiCreate.Com jQuery Tutorials</title> <style> body{ font-size: 12px; font-family: Arial; } </style> <script type="text/javascript" src="jquery-1.6.4.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#btn1").click(function(){ $("#div1").load("jQueryload3.php", function(response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error: "; $("#div1").html(msg + xhr.status + " " + xhr.statusText); } }); }); }); </script> </head> <body> <div id="div1"></div> <input type="button" id="btn1" value="Load"> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท