srhyne / jQuery-Parse

An AJAX wrapper for the Parse.com REST API
212 stars 31 forks source link

Add to array #20

Closed grebbekevin closed 9 years ago

grebbekevin commented 9 years ago

Is there a way to add a value to a array with the jquery parse class?

srhyne commented 9 years ago

Hi Kevin,

Is it Kevin? Yes, I'm pretty confident you can do this without any changes at the moment.

From the docs, you can see that adding to an array is simply just nested JSON.

Image

So in $.parse..

var update = { 
    skills : {
        __op : 'AddUnique',
        objects : ['flying', 'kungfu']
    }
};

$.parse.put("Class/" + id, update, function(json) { console.log('updated ' + id, json) });

So it's just like a regular update but with a specific JSON format