Home > Web Front-end > JS Tutorial > body text

Detailed explanation of examples of jQuery framework Ajax

零下一度
Release: 2017-07-23 13:48:03
Original
1202 people have browsed it

json (JavaScript Object Notation): lightweight data exchange (the exchanged data is converted into a platform-independent) format

  1. Convert java objects into json strings, using ObjectMapper Class writeValueAsString(java object);

  2. Convert a json string or an array string composed of json objects into a javascript object using the parse function provided by the javascript built-in object JSON

$.ajax() method

$.ajax({
    url:请求地址(相对),
    type:请求类型,
    data:请求参数(可以字符串形式还可以是对象形式{"adminCode":"king","age":22}),
    dataType:服务器返回的数据类型 "json" javascript对象 
                    "text" 文本
                    "html" html文档
                    "xml" xml文档
                    "script" javascript脚本,
    success:绑定事件处理函数  function(任意参数表示服务器返回的数据){},
    error:绑定事件处理函数(服务器出错了) function(){}
});
Copy after login

The above is the detailed content of Detailed explanation of examples of jQuery framework Ajax. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!