Read object

After saving the object we would like to call it back and present it on our page. To do so we will use the 

objectId  of the record which is in our example "uD3KzzDd2b".  Keep in mind that all  objectId are unique values, so if you are following the steps please copy your objectId from your table.

In order to retrieve our object we are going to use the Simbla.query   that we will explain more about in our next guide.


We wish to present our final result on our page using our HTML element. Here is our HTML code:

<div Style="padding:30px;border:1px solid red">
   <H1 Id="cmodel"></H1></br>
    <h3 id="cyear"></h3></br></br>
    <p id="ccode"></p></br></br>
</div>   
   

   



Our Javascript code retrieving the record:

var car = Simbla.Object.extend("Cars");
var query = new Simbla.Query(car);
query.get("qxFYhsu14o", {
   success: function(car) {

$("#cmodel").html(car.get("car_model"));
$("#cyear").html(car.get("car_year"));
$("#ccode").html(car.get("car_code"));
     
    },
     error: function(car, error) {

   alert("Error - The object was not retrieved successfully" + error.message);
   
   
  }
});

To retrieve values from Simbla.object , use the get method:

var cyear= car.get("car_year");
var ccode= car.get("car_code");
var ccolor= car.get("car_color");
var cmodel= car.get("car_modle");

The three reserved values are provided as properties and cannot be retrieved using the 'get' method nor modified with the 'set' method:

var objectId = car.id;
var updatedAt = car.updatedAt;
var createdAt = car.createdAt;