i use reste library to handle api on titanium appcelerator :
this is my config :
api.config({
debug : true,
autoValidateParams : false,
validatesSecureCertificate : false,
timeout : 4000,
url : Kb.baseUrl,
models: [{
name: "product",
id: "id",
//content: "retArray",
collections: [{
name: "products",
content: "response",
read: "get_products"
}],
}],
methods : [
{
name : "get_products",
post : "api/get_product"
}
],
...
So this how i fetch (works perfectly) :
var p = Alloy.Collections.get_products;
p.fetch({
success:function(m,r){
console.log(r)
}
});
Now i have to past object to post (this not working, why?) :
p.fetch({
data:{'id':'2'},
success:function(m,r){ console.log(r); }
});
This second fetch not working, have you an idea ?
thanks.