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

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.

主站蜘蛛池模板: 逊克县| 阿坝| 辰溪县| 阳信县| 洱源县| 溧水县| 山阳县| 海丰县| 玉溪市| 洪泽县| 莱阳市| 张掖市| 肃宁县| 凤城市| 新郑市| 揭阳市| 林芝县| 聂拉木县| 卢龙县| 杭锦旗| 锡林浩特市| 漯河市| 铁力市| 日照市| 黎城县| 密云县| 泽库县| 昂仁县| 邵东县| 方城县| 太仆寺旗| 洛浦县| 鹤壁市| 连江县| 阳曲县| 科技| 大关县| 富川| 鄂伦春自治旗| 望奎县| 永宁县|