0

I am using backendless.com as a BaaS. So, I can not add objects to existing table. That`s why I am creating table in my .js file:

function Contacts(args) {
    args = args || {};
    this.age = args.age || "";
    this.name = args.name || "";
    this.title = args.title || "";
}
function sendData () {
  var age = document.getElementById("age").value,
    name = document.getElementById("name").value,
    title = document.getElementById("title").value;

  var requestObject = new Contacts( {
    age: age,
    name: name,
    title: title,
  });

  var savedRequest = Backendless.Persistence.of( Contacts ).save( requestObject );
}

This is index.html file:

<form onsubmit="sendData()">
      <input type="text" placeholder="age" id="age"><br>
      <input type="text" placeholder="name" id="name"><br>
      <input type="text" placeholder="title" id="title"><br>
      <input type="submit" value="Submit">
</form>

But what I need is to add objects to tables which I already created in Backendless.com. I have table called: Contacts with columns: age, name, title. How should I do that?

1 Answers1

0

If you consequently save the objects using Backendless.Persistence.of( Contacts ).save( obj ) then the table will be created on the first request (if it hasn't been created yet) and after that the objects will be just saved to the same table.

Scadge
  • 9,380
  • 3
  • 30
  • 39