Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add data to table and get from table using Backendless.com

I am using "backendless.com" as a BaaS, what I need is to get data from table. Here I am saving object to table:

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 );
}

This is my index.html file:

<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>

After that, when object was saved to table, I want to call this object, and put it to my table (after clicking submit button): like that

How should I do that?

like image 444
Nuriddin Zuhirxojaev Avatar asked Jul 12 '26 21:07

Nuriddin Zuhirxojaev


1 Answers

The result of the following API call:

Backendless.Persistence.of( Products ).save( requestObject )

that is the value you put into the savedRequest variable IS the actual saved object. You should be able to use the object in that variable to render it in your UI.

like image 55
Mark Piller Avatar answered Jul 15 '26 10:07

Mark Piller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!