データを付加して、test.phpにGET送信した結果を表示します。
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>jQuery::非同期通信::Ajaxリクエスト::jQuery.get(url[, data[, callback[, type]]])の使用例</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <!-- JS --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script> $(function(){ $.get("/content/demo/test.php", { name:"John", time:"2pm"}, function(data){ $("#res").html("読込まれたデータ:<br><br>"+data); } ); $.get("/content/demo/test.php", { 'choices[]':["Jon", "Susan"]}, function(data){ $("#res2").html("読込まれたデータ:<br><br>"+data); } ); }); </script> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <!-- CONTENT --> <h1>jQuery::非同期通信::Ajaxリクエスト::jQuery.get(url[, data[, callback[, type]]])の使用例</h1> <p>データを付加して、test.phpにGET送信した結果を表示します。</p> <!-- CODE --> <div id="res"></div> <div id="res2"></div> <!-- / CODE --> <!-- / CONTENT --> </body> </html>