Hello, I'm having problems while getting JSPN from PHP, shown below:
[{
"vehicleId": "1",
"status": "Running",
"position": "x",
"battery": "25",
"distanceTravelled": "123",
"destination": "y",
"freeSeats": "2",
"speed": "32"
}
]
But, my new version of my code it is comes like that (without quotes in number values) and it gives a parse Json error and it doen't shown anything.
[{
"vehicleId": 1,
"status": "Running",
"position": "x",
"battery": 25,
"distanceTravelled": 123,
"destination": "y",
"freeSeats": 2,
"speed": 32
}
]
I checked the format at jsonlint.com and it is valid. The error in log in Eclipse is:
05-09 21:37:25.536: E/Web Console(336): SyntaxError: Unable to parse JSON string at file:
34 xmlhttp.open("GET",url,false);
35 xmlhttp.send();
36 var json = xmlhttp.responseText;
37 obj = JSON.parse(json);
I also tried the Javascript code in my computer on Chrome and everything works fine. I couldn't resolve the problem. Thanks for your answers.