W3.JS Http တောင်းဆိုမှုများ
ဆာဗာများမှ ဒေတာကို ဖတ်ပါ-
w3.getHttpObject(file.js,function)
ဝဘ်ဆာဗာတစ်ခုမှ ဒေတာကို တောင်းဆိုထားသည်မှလွဲ၍ ဤစာမျက်နှာရှိ နမူနာများသည် ယခင်စာမျက်နှာရှိ နမူနာများနှင့် အတူတူပင်ဖြစ်သည်- customers.js
Dropdown ဖြည့်ခြင်း။
ဥပမာ
<select id="id01">
<option w3-repeat="customers">{{CustomerName}}</option>
</select>
<script>
w3.getHttpObject("customers.js", myFunction);
function myFunction(myObject) {
w3.displayObject("id01", myObject);
}
</script>
စာရင်းဖြည့်ခြင်း။
ဥပမာ
<ul id="id01">
<li w3-repeat="customers">{{CustomerName}}</li>
</ul>
<script>
w3.getHttpObject("customers.js", myFunction);
function
myFunction(myObject) {
w3.displayObject("id01", myObject);
}
</script>
ဇယားတစ်ခုဖြည့်
ဥပမာ
<table id="id01">
<tr>
<th>Customer</th>
<th>City</th>
<th>Country</th>
</tr>
<tr w3-repeat="customers">
<td>{{CustomerName}}</td>
<td>{{City}}</td>
<td>{{Country}}</td>
</tr>
</table>
<script>
w3.getHttpObject("customers.js", myFunction);
function
myFunction(myObject) {
w3.displayObject("id01", myObject);
}
</script>
ဇယားနောက်ထပ်ဖြည့်
ဥပမာ
<table id="id01">
<tr>
<th>Title</th>
<th>Artist</th>
<th>Price</th>
</tr>
<tr w3-repeat="cd">
<td>{{title}}</td>
<td>{{artist}}</td>
<td>{{price}}</td>
</tr>
</table>
<script>
w3.getHttpObject("cd_catalog.js", myFunction);
function
myFunction(myObject) {
w3.displayObject("id01",
myObject);
}
</script>