I am trying to create a dynamic array and push elements to it using Javascript. Being a begineer, I have having problems with it.
P.S. I am fetching the values all fine (checked with console.log), the only problem is that I am unable to put it in the database.
Below is my code -
(function makelist()
{
var listHeaderData =[];
var listChildData = [];
var listImagePath = [];
var nextPageRefLink = ['imageSlider.html','NewsItem_descp_1.html','http://www.yahoo.com'];
Parse.initialize("XN0sv3fBqB380fCpwohuHAgansghkiDp8MhbyJDs", "xzoETxUUxicHAtdwqbZh65XtTAFaona3a6cC9jSB");
console.log("Parse Initailized inside javascript");
var newsFeed = Parse.Object.extend("NewsFeed");
var query = new Parse.Query(newsFeed);
query.find({
success: function(results){
var output ="";
for(var i in results) {
//listHeaderData DATA
var heading = results[i].get("Heading");
listHeaderData.push(heading);
console.log("Header : "+heading);
//listChildData DATA
var description = results[i].get("description");
listChildData.push(listChildData);
console.log("Description : "+description);
if(results[i].get("Image")) {
var file = results[i].get("Image");
//listImagePath URL's
var url = file.url();
listImagePath.push(url);
console.log("Image URL is:"+url);
}
console.log("Heading:"+heading);
console.log("Description:"+description);
}
} , error: function(error){
console.log("Query error :"+error.message);
}
});
What can be the problem ?