I am writing some code to train myself on ExtJS methods. I am also new to JSON, so hopefully this question will be easy for you to answer. I am trying to get some data from a basic web service that I wrote that should return its results as JSON (seeing that I am new to JSON - maybe this is broken).
The error I get is
SyntaxError: none) in parentheses
The JSON that I am returning from the web service,
{ "rows": [ { "id": "100000", "genre_name": "Action", "sort_order": "100000" }, { "id": "100002", "genre_name": "Comedy", "sort_order": "100002" }, { "id": "100001", "genre_name": "Drama", "sort_order": "100001" }] }
My ExtJS code is below. The loadexception is where I got the JSON and the error above from
var genres = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ method: 'POST', url: 'http://localhost/extjs_training/Demo_WebService/Utility.asmx/GetGenres', failure: function(response, options){ Ext.get('my_id').dom.innerHTML = 'Load failed: ' + response.status; } }), reader: new Ext.data.JsonReader({ fields: ['id', 'genre_name'], root: 'rows' }), listeners: { loadexception: function (proxy, options, response, e) { var result = response.responseText; Ext.MessageBox.alert('Load failure', e + " ..... " + result); } } }); var loadSuccess = genres.load({ callback: function(r, options, success){ Ext.get('my_id').dom.innerHTML = 'Load status: success=' + success; } });
source share