javascript - Failed with: Uncaught Tried to save an object with a pointer to a new, unsaved object -


i having error, , cloud code.

var highscore = parse.object.extend("highscore"); highscore = new highscore(); highscore.set("totalxp", request.params.totalxp); highscore.set("regionid", request.params.regionid);  var relation = highscore.relation("userid"); relation.add(request.user);  highscore.save();  response.success(highscore); 

the response returned empty, weird thing is, relation added when @ data browser.

can't find solid answer or explanation. please help.

i referred here, , modified code it. reason because put creating object , adding relation in 1 save() operation.

var highscore = parse.object.extend("highscore"); highscore = new highscore(); highscore.set("totalxp", request.params.totalxp); highscore.set("regionid", request.params.regionid);  highscore.save(null, {     success: function(savedhighscore){             var relation = savedhighscore.relation("userid");             relation.add(request.user);             //relation.add(parse.user.current());         savedhighscore.save(null, {             success: function(finalhighscore){                 response.success(finalhighscore);             },             error: function(finalhighscore, error){             }         });     },     error: function(highscore, error){         console.log("failed create");     } }); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -