[quote="aunohara"]getdata.php
[code]
<?
/**Author by Kuan, 13 Oct 2006**/
$arrWebsite = array(
array("
www.thaifreelancebid.com", "
www.thaiportfolio.com", "
www.thaigoogletalk.com"),
array("
www.siamdev.com")
);
$result = "";
if($_GET['id'] != ""){ // ถ้า id ไม่เท่ากับค่า ว่างๆ ก็ให้ทำงาน ตาม คำสั่ง
$c = count($arrWebsite); // นับ สมาชิก จำนวนตัวแปล array
if($c > 0){ // ถ้ามากกว่า 0 ให้ทำงาน
$items = $arrWebsite[(int)$_GET['id']]; // กำหนด ค่า ให้ ตัวแปล $items ตาม ตัวแปล $arrWebsite ที่มี index ตามที่ ส่งค่าเข้ามา
$ci = count($items);
for($i=0; $i<$ci; $i++){
$result .= $items[$i]."\t"; // loop เพื่อ กำหนด ค่า ให้ กับ ตัวแปล $result
}
if($result != ""){
echo $result; // แสดง ค่า ของ $result ออก
}
}
}
?>[/code][/quote]
เป็นการ กำหนด ข้อมูล โดย เวลานำไปใช้งาน จริง ตัว $arrWebsite เราต้อง ดึงมาจาก DB
ส่วน อีก ไฟล์ เป็น AJAX ที่ มาเรียก ใก้ ไฟล์น ี้ทำงาน