Data Eval broken or am I missing something?
Hi, I was working on a project, but it suddenly stops evaluating data array from php to json output. I loaded older backups, but not a chance. Here's my code and error output. Thank you very much.
Code Sample ->
var data = eval('('+this.responseText+')');
infoView.text = data.length;
totalEvent = data.length;
Ti.API.info(data);
for (var c=0;c<data.length;c++){
eventName = data[c].eventName;
eventVenue = data[c].venueName;
eventTime = data[c].eventTime;
eventId = data[c].eventId;
mountainView[c] = Titanium.Map.createAnnotation({
});
Error ->
line = 111;
message = "Result of expression 'data' [null] is not an object.";
name = TypeError;
sourceId = 149940432;
I also tried json.parse() but nope :(
2 Answers
-
Accepted Answer
You're sure you used the JSON.parse() method instead of eval? Other than that, use jslint.com to validate the JSON you're sending back.
-
Ryan, jslint says it's a valid data. Surprisingly, it started to work again. May be server side issue. Thank you again.