ExtJS - SyntaxError: none) in parentheses

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; } }); 
+4
source share
2 answers

Is the JSON that you included above what is actually coming back from this call, or what do you expect from it should look like this? The line you included looks clean, but it looks like you formatted it. I am not sure if space is allowed after "id" :. However, this may not be very.

A missing parenthesis usually indicates that something in JSON is erroneous. This may be an extra character before / after the line. Use Firebug to verify that you are returning and make sure that it does not contain extra characters.

+4
source

http://www.sencha.com/forum/showthread.php?10117-Solved-missing-%29-in-parenthetical .

In my case, the reason was an explanation of two statements. Therefore, repeat the repeat.

0
source

All Articles