ऐपएमएल एपीआई
AppML API, 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
कुछ ऐपएमएल तरीके
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. |
कुछ ऐपएमएल गुण
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 |