0

my class having the 3 records and 3 objects. how i iterate the multiple objects and how i get the details of those objects thank you advance.

it is working with one object id manual

 query.get("36iUEFs7YL", 
  {
    success: function(res) {      
     var objectId=res.id;
            var productName=res.get("ProductName");
            var productPrice=res.get("ProductPrice");
            var productQuantity=res.get("ProductQuantity");
            console.log("Id is:"+objectId);
            console.log("test1"+productName);
            console.log("test2"+productPrice);
            console.log("test3"+productQuantity);
         },
  error: function(object, error) 
   {
        console.log("ERROR::"+error.message);
   }
});

o/p: Id is:36iUEFs7YL
test1deal
test21233
test310

0

1 Answer 1

1

Finally i got it

  query.find({
 success: function(results) {

console.log(results.length);
// Do something with the returned Parse.Object values
 for(i=0;i<results.length;i++)
     {
  var object = results[i];
         productname=object.get('ProductName');
         productPrice=object.get('ProductPrice');
         productQuantity=object.get('ProductQuantity');
    console.log(object.id + ' - ' + object.get('ProductName'));    
    //document.getElementById("app_name").innerHTML= productname;
    console.log(object.id + ' - ' + object.get('ProductPrice'));
    //document.getElementById("app_price").innerHTML= productPrice;
    console.log(object.id + ' - ' + object.get('ProductQuantity'));
    //document.getElementById("app_quantity").innerHTML= productQuantity;    
   }
  },
  error: function(error) {
   alert("Error: " + error.code + " " + error.message);
  }
 });

o/p:3 36iUEFs7YL - deal
36iUEFs7YL - 1233
36iUEFs7YL - 10
omU8oo7DOM - Samsung
omU8oo7DOM - 12500
omU8oo7DOM - 12
8oegUWDl6W - idea
8oegUWDl6W - 12

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.