AppML API
AppML API กำหนดวิธีการและคุณสมบัติของ AppML
วิธีการและคุณสมบัติสามารถทำอะไรได้บ้าง?
ด้วยวิธีการและคุณสมบัติ คุณสามารถ:
- สร้างแอปพลิเคชัน AppML
- ฟีดแอปพลิเคชันด้วย data
- ดึงข้อมูลแอปพลิเคชันเพื่อใช้ในหน้าเว็บของคุณ
ตัวอย่าง
new AppML()สร้างวัตถุ AppML ใหม่
dataSourceตั้งค่าแหล่งข้อมูลของวัตถุ AppML
getData()รับข้อมูล
data.recordsมีบันทึกข้อมูล
คุณสามารถวนรอบระเบียนและแสดงเนื้อหาในองค์ประกอบ HTML:
ตัวอย่าง
// Create an AppML object and fetch the data
myObj = new AppML();
myObj.dataSource = "https://www.w3schools.com/appml/customers.php";
myObj.getData();
// Locate the data records
myArr = myObj.data.records;
len = myArr.length;
// Display the records
for (i = 0; i < len; i++) {
txt += myArr[i].CustomerName + "<br>";
}
document.getElementById("demo").innerHTML = txt;
ผลลัพธ์
Alfreds Futterkiste
Berglunds snabbköp
Centro comercial Moctezuma
Ernst Handel
FISSA Fabrica Inter. Salchichas S.A.
Galería del
gastrónomo
Island Trading
Königlich Essen
Laughing Bacchus Wine
Cellars
Magazzini Alimentari Riuniti
North/South
Paris spécialités
Rattlesnake Canyon Grocery
Simons bistro
The Big Cheese
Vaffeljernet
Wolski Zajazd
วิธีการ AppML บางอย่าง
Method | Description |
---|---|
new AppML() | Creates a new AppML object |
run() | Runs an application object |
appml("name") | Returns the appml object with the specified name |
displayMessage(text) | Displays a specified message. |
setError(no, description) | Sets a specified error and error description. |
คุณสมบัติ AppML บางอย่าง
Property | Description |
---|---|
appName | The application name (the container id) |
container | The application container element |
controller | The application controller |
data | The application data object |
dataSource | The application data source |
message | The application message |
คุณสมบัติอ็อบเจ็กต์ข้อมูลบางอย่าง
Property | Description |
---|---|
data.model | The application data model |
data.records | The application data records |