<%
/free
consoleLog('Any text can go to the console');
*inlr = *ON;
%>
This text will now occur in the browser debugger console along with other consol log notifications:
When you are building XML or JSON based applications you can log objets and arrays from the IceBreak
XML and JSON parser directly. The following code is using both simple strings and complex JSON
objects:
<%
// Example:
// Using the "consoleLog" on Json objects
// ------------------------------------------------------------------
d pJson s * d subobj s *
/include qasphdr,jsonparser
/free
*inlr = *ON;
consoleLog('Demo of JSON objects. First parse a string');
consoleLog('{ "manuid":"CASIO", "price" :123.45 }');
pJson = json_ParseString ('{ +
"manuid":"CASIO", +
"price" :123.45, +
"subobj": { +
"a": 1, +
"b": 2, +
"c": 3 +
}+
}');
if json_Error(pJson) ;
consoleLog('Json error:' + json_Message(pJson));
json_Close(pJson);
return;
endif;
consoleLog('Json parser ran ok, now show the contents');
consoleLogJson(pJson);
consoleLog('Now only show the "subobj" object:');
subobj = json_locate(pJson : 'subobj');
consoleLogJson(subobj);
json_Close(pJson);
%>
Which will result in the following output in firebug / chrome console: