However, I have some minor issues that I need to clarify before I go on a full scale editing to all my extensions. Currently I have an extension calling data from a db this way.
Code: Select all
-- Server extensions
var names = []
var sql = "getNames";
var queryRes = dbase.executeQuery(sql);
if (queryRes != null) {
if (queryRes.size() > 0) {
for (var i = 0; i < queryRes.size(); i++) {
var nameList = [];
nameList[0] = tempRow.getItem("id"); // returns correct id
nameList[1] = tempRow.getItem("name"); // returns name
names.push(nameList);
}
}
}
var res = {}
res._cmd = "nameList";
res.namelist = names;
trace(res.namelist) // returns correct values on server trace
_server.sendResponse(res, -1, null, [user], "json");
---- Client
case "nameList" :
var nameList = resObj.namelist;
trace("nameList: " + nameList);
// this returns blank (not undefined values but blank) using json protocol but using xml it returns correctly
break;I then tried changing:
Code: Select all
FROM
nameList[0] = tempRow.getItem("id"); // returns correct id
nameList[1] = tempRow.getItem("name"); // returns name
TO
nameList[0] = String(tempRow.getItem("id")); // returns correct id
nameList[1] = String(tempRow.getItem("name")); // returns nameIs this the problem with JSON protocol? Do I have to convert all data to a type, if not the protocol will actually convert it to blank? A little bit confusing here... cos I thought JSON and XML protocol is almost the same.
Regards,
darnpunk