I am using a custom RESTFUL API:
https://github.com/viezel/napp.alloy.adapter.restapi
This seems to be recommended by people on here.
controller class, invoked within an event handler:
var matches = Alloy.createCollection("match"); //var matches = Alloy.Collections.match; // fetch the data GET /* matches.fetch({ success: function(){ // console.log(matches); //alert('here'); Ti.API.info("api response:"+JSON.stringify(matches)); //alert(Json); // add to your listview }, error: function(){ // something is wrong.. } }); */ var param={ facebook_token:"dasd", nickname:"a", yob: '1876', description:"I am a test object" }; Ti.API.info('Params'+JSON.stringify(param)); matches.create(param);I am able to fetch data front he code that is commented out, however when I try to create the data (POST), I have no idea how to get a response. It just responds with the JSON object I have sent, when it should rrrespond with a json object from my api server.
model class, match.js: exports.definition = { config: { URL: 'http://xxxxxxxxx.com/user', columns: { }, adapter: { "type": "restapi", // sql || restapi "collection_name": "match", "idAttribute": "Id" } }, extendModel : function(Model) { _.extend(Model.prototype, {}); return Model; }, extendCollection : function(Collection) { _.extend(Collection.prototype, {}); return Collection; } };