viezel / napp.alloy.adapter.restapi

RestAPI Sync Adapter for Titanium Alloy Framework
197 stars 102 forks source link

Sending params with save() #40

Closed theninthnode closed 10 years ago

theninthnode commented 10 years ago

I'm trying to save a model to an endpoint but I just can't figure out how to send the data:

var fav = Alloy.createModel('favourite');
fav.save({item_id: item._id}, {
    success: function(){
        Ti.API.info('Success');
    },
    error: function(){
        Ti.API.info('error');
    }
});

Also tried:

var fav = Alloy.createModel('favourite');
fav.set('item_id', item._id);
fav.save({}, {
    success: function(){
        Ti.API.info('Success');
    },
    error: function(){
        Ti.API.info('error');
    }
});

With debug on I can see the output:

"url": "http://localhost:4000/users/me/favourites", "data": "{}"

How do I send params along with the save?

viezel commented 10 years ago

Please use Q&A for this kind of questions.