当前位置:网站首页>Simple understanding of XML and JSON

Simple understanding of XML and JSON

2022-06-11 06:01:00 Not bald

XML And JSON,Ajax Simple understanding

XML And JSON

XML Is an extensible markup language , Designed to transmit and store data .
effect :
1. Data transmission tools between programs
2. The configuration file
3. As a small database
characteristic :
1. Labels must be customized
2. Label case sensitive
3. Special symbols should use entity characters (&it Is the less than sign ,&gt Is the greater than sign ······)
4.XML Attribute values must be quoted

<root>
  <to>henan</to>
  <!DOCTYPE note SYSTEM "Note.dtd">
  <from>anhui</from>
  <heading>Reminder</heading>
  <body>let go to there</body>
</root>

XML Must contain the root element , It's the parent of all the other elements , such as root It's the root element ,DOCTYPE The declaration is external DTD References to documents .

JSON Is the syntax for storing and exchanging text information , similar XML, however Than XML smaller 、 faster , Easier to parse .
JSON The functions and XML be similar .
characteristic :
1. Content summary , Easy to understand
2. No end tag
3. Able to use JavaScript eval() Method
4. Using arrays
5.JSON Objects in braces {} In the writing

myObj = {
    
    "name":"bilibili",
    "alexa":10000,
    "sites": {
    
        "site1":"https://www.bilibili.com/",
        "site2":"https://www.bilibili.com/",
        "site3":"https://www.bilibili.com/"
    }
}

Ajax request

A way to do this without reloading the entire web page , Technology that can partially update web pages
Yes $.ajax Method
as follows :
url: Requested address
type : Type of request get( Security is not as good as post But fast ) or post( High security but slow speed ) request
data: Data sent to the server , There are two formats name=value&name=value; {key:value}
success: The request is successful , The callback function of the response
dataType : The data type of the response
Common data types are :text For plain text ,xml Express xml data ,json Express json object .

also . g e t and .get and .get and .put Method
Compared with $.ajax Simple comparison
The format is as follows :
url Requested url Address
data Data sent
callback Successful callback function
type Data type returned

原网站

版权声明
本文为[Not bald]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020530436900.html