-
8 Nov 2012 2:20 PM #1
Answered: JSON Error on phone not on desktop
Answered: JSON Error on phone not on desktop
Hi,
After packaging my app (sencha command build), I've upload my app on a
server to test the result.
Everything is ok on my desktop on google chrome but not working on the
navigator of my phone (androïd 2.3.6).
On the phone's navigator, I've got this message :
"[WARN][Ext.data.reader.Reader#process] Unable to parse the JSON
returned by the server: Error: You're trying to decode an invalid JSON
[...]"
I've set my JSON on JSONLint : valid.
I've check the result in the network console : 200 - application/json -
UTF8.
Here is the url on the JSON :
http://nantesparcours.lafamillebn.ne...angements/zone
As it may come from the store code :
Code:Ext.define("MyApp.store.Changes", { extend: "Ext.data.Store", config: { model: "MyApp.model.Change", proxy: { type:'ajax', url:'http://nantesparcours.lafamillebn.net/api/changements/zone', reader: { type:'json', rootProperty:'changement', }// reader }, // proxy sorters: [ { property: 'horodatage', direction: 'DESC' } ], }, // config }); // fin
Thanks for any help. Hope to give all info ...
-
Best Answer Posted by xiii29
For info, I've also update to sencha touch 2.1 but ajax / json i've still have to trouble. Working fine with JSONP.
-
10 Nov 2012 5:53 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3157
Are you loading your app on the nantesparcours.lafamillebn.net domain or from another domain?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
10 Nov 2012 10:04 AM #3
Hi,
I'm loading from another subdomain. For a while i've some message of Allow Acces but I'm managed by changing the configuration of my web server. And it's working now.
On my phone javascript console, I can see the content of my data just after the error message ...
I'm wondering if it's not a encondig trouble ...
-
10 Nov 2012 11:10 AM #4
I remember that some old iPhone versions did not support JSON. You might want to test the following:
Just to make sure its not because of the phone.Code:if(!window.JSON) alert("No - this really does not support JSON");
-
10 Nov 2012 12:53 PM #5
One of my store load a local json files and it's working fine ...
-
10 Nov 2012 3:23 PM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3157
What I was getting at is the cross origin security which you just have to send a header to support CORS.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
11 Nov 2012 1:40 AM #7
Hi,
I'm sorry I'm not to understand your last message ... (my english is as good as ... my sencha
.
To resolved the cross error, i've changed my .htaccess by adding to lines that allow the needed request.
For now, i've still the error on Androîd while it's working fine on desktop ...
-
11 Nov 2012 2:42 AM #8
I've set up a JSON Viewer App on my phone and load my url ==> no error ... (https://play.google.com/store/apps/d...=search_result)
-
11 Nov 2012 12:24 PM #9
Hi,
On order to move forward, I've develop a very small app that's just load the distant file. On my web site, I've change the return, in order to remove data. The service return only to root name :
I've put the new app on my server and the problem persist but I've found that the javascript console of my app writeCode:{"c":""}From what I see in the code, there is no reason for my string to be recopied in the error message ...Code:[Warn][Ext.data.reader.Reader#process] Unable to parse [...] an invalid JSON STring: {"c:"" }{"c":""}
-
12 Nov 2012 10:39 AM #10
Hi ...
I've made lot of trace directly on the sencha src to see what happen. As far as I am, the text is "doubled" directly in the response in src/proxy/Server :
When I look on my phone (Adnroïd : 2.3.6) the response.responseText : {"c":"""}{"c":"""}Code:221 processResponse: function(success, operation, request, response, callback, scope) { 222 console.log("Servers.js : processResponse"); 223 console.log(request); 224 console.log(response.responseText); 225 console.log("Servers.js : processResponse apres log");
the same on Google Chrome Desktop :{"c":"""}
For info : i made a test on a old Iphone : {"c":""} ...
UPDATE : I've made a test on Androïd 4.1.2 --> look's fine ...


Reply With Quote