AppML API
The AppML API defines the methods and properties of AppML
What Can Methods and Properties Do?
With methods and properties you can:
- Create AppML applications
- Feed applications with data
- Fetch application data for use in your web page
Приклад
new AppML() creates a new AppML object.
dataSource sets the data source of the AppML object.
getData() gets the data.
data.records contains the data records.
You can loop the records and display the content in an HTML element:
Example
// Create an AppML object and fetch the data
myObj = new AppML();
myObj.dataSource = "https://www.w3schools.com/appml/customers.html";
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 Методи
Метод | Опис |
---|---|
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 Властивості
Властивість | Опис |
---|---|
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 |
Деякі властивості об’єкта Data
Властивість | Опис |
---|---|
data.model | The application data model |
data.records | The application data records |