PHPプログラミング実戦15-16/17
1595 ワード
フロントエンド
バックグラウンドpredator_prey.php
ポイント load()メソッドは、AJAXによってサーバからのデータのロードを要求し、返されたデータを指定された要素に配置します.
Predator/Prey Example
$(document).ready(function(){
$("#predator").click(function(){
$("#response").load("predator_prey.php?type=predator");
})
$("#prey").click(function(){
$("#response").load("predator_prey.php?type=prey")
});
});
Ajax response form PHP:
バックグラウンドpredator_prey.php
ポイント