官术网_书友最值得收藏!

  • qooxdoo Beginner's Guide
  • Rajesh Kumar Bachu Mohamed Raffi
  • 449字
  • 2021-08-20 15:45:11

Passing data to the server

qooxdoo uses the JSON format to transfer the data between the client browser and the web server. JSON is a light-weight data interchange format. JSON is very light when compared to the XML format. It is easy for humans to read and write. It is easy for machines to parse and generate. We have mentioned the JSON standard format in this section. This information is good enough to work with JSON. If you want to read more, you can visit the JSON website (http://www.json.org/).

JSON standard format

The Date object is an exception in the formatting as JavaScript does not have a literal syntax for the Date object.

Date objects are sent as the following tokens:

  • The string—new Date (Date.UTC(
  • The year, integer; for example, 2006
  • A comma
  • The month, 0-relative integer; for example, 5 (that is, June)
  • A comma
  • The day of the month, integer, range: 1-31
  • A comma
  • The hour of the day on a 24-hour clock, integer, range: 0-23
  • A comma
  • The minute of the hour, integer, range: 0-59
  • A comma
  • The second within the minute, integer, range: 0-59
  • A comma
  • The milliseconds within the second, integer, range: 0-999
  • The string—))

A resulting date representation might therefore be:

new Date(Date.UTC(2006,5,20,22,18,42,223))

While working with date strings, you must take care with the following:

  • Whitespace: The following points should be remembered:
    • When generating these date strings, implementations should not add whitespace before, after, or between any of the fields within the date string.
    • When parsing these date strings, implementations should allow whitespace before, after, or between any of the fields within the date string.
  • Numbers: The following points should be remembered:
    • When generating these date strings, implementations must not add leading zeros to the numeric values in the date string. Doing so will cause them to be parsed as octal values. Numbers must be passed in decimal (base 10) notation without leading zeros.
    • When parsing these date strings, implementations must take the integer value of numeric portions of the string as base 10 values, even if leading zeros appear in the string representation of the numbers.

Within the JSON protocol and in JSON messages between peers, Date objects are always passed in UTC format.

A sample JSON content to explain the file menu contents that contain the members, pairs, values or strings, arrays, and so on in the JSON format is as follows:

{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

What just happened?

We got to know about the data format that is passed between client and server in qooxdoo applications.

主站蜘蛛池模板: 安吉县| 铜鼓县| 南部县| 新建县| 新野县| 南漳县| 长兴县| 维西| 比如县| 虎林市| 广西| 砚山县| 青州市| 凌海市| 紫阳县| 台山市| 涿州市| 临武县| 财经| 龙里县| 乌兰浩特市| 甘孜| 吉隆县| 凤城市| 台中县| 安义县| 邵阳市| 兴文县| 云阳县| 青铜峡市| 托克托县| 兴隆县| 崇礼县| 阿克苏市| 沁水县| 大城县| 二连浩特市| 郑州市| 石首市| 科尔| 金平|