I have this model
var Item = Backbone.Model.extend({ url: 'http://localhost/InterprisePOS/Product/loaditembycategory/Event Materials' }); var onSuccess = function(){ alert("success"); };
And a collection
var Items = Backbone.Collection.extend({ model: Item });
And the rest of my code is here:
var item = new Item(); var items = new Items(); item.fetch({ success: onSuccess }); alert(items.get("ItemCode"));
I want to just get the attributes of the model. Now I have it on firebug. Also, when I run it in a browser, I get a success warning, and the next warning is undefined .
This is the conclusion:
{"ErrorMessage":null,"Items":[{"ErrorMessage":null,"CategoryCode":"Event Materials","ClassCode":null,"Components":null,"GroupCode":null,"ImageURL":null,"ItemCode":"ITEM-123","ItemDescription":"Old World Lamppost\u000d\u000a\u000d\u000a","ItemName":"GET123","ItemType":null,"KitItem":null,"Matrix":null,"Prefix":null,"RetailPrice":107.990000,"SalesTaxCode":null,"UPCCode":null,"UnitMeasureCode":"EACH","UnitsInStock":0,"Value":null,"WholesalePrice":95.000000}]}
Note
This is just one of the elements that it returns. I just wrote on the subject so that it is not so long.