我使用“backendless.com”作为 BaaS,我需要从表中获取数据。在这里,我将对象保存到表中:
function Products(args) {
args = args || {};
this.name = args.name || "";
this.quantity = args.quantity || "";
this.price = args.price || "";
}
function sendData () {
var age = document.getElementById("age").value,
name = document.getElementById("name").value,
title = document.getElementById("title").value;
var requestObject = new Products( {
name: name,
quantity: quantity,
price: price,
});
var savedRequest = Backendless.Persistence.of( Products ).save( requestObject );
}
这是我的 index.html 文件:
<form onsubmit="sendData()">
<input type="text" placeholder="name" id="name"><br>
<input type="text" placeholder="quantity" id="quantity"><br>
<input type="text" placeholder="price" id="price"><br>
<input type="submit" value="Submit">
</form>
之后,当对象被保存到表时,我想调用这个对象,并将它放到我的表中(点击提交按钮后): 就像那样
我该怎么做?