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

jQuery学习笔记(1)--用jQuery实现异步通信(用json传值)具体思路_jquery

WBOY
Release: 2016-05-16 17:37:57
Original
1019 people have browsed it

       jQuery是时下比较流行的一个js库,能够用简单的代码做出理想的效果,就像官网上说的那样“write less ,do more”。Jquery在一定程度上改写了以往对JavaScript的写法,本人就用jquery实现上篇中用ajax实现异步通信的效果,感受一下jquery的魅力。

     首先你需要下载jquery的最新的js文件,并将其引入到文件中,你也可以在此下载:点我下载

     这次通信用的是jquery的jQuery.post(url,[data][callback],[type])方法,这是一个简单的POST 请求功能以取代复杂 $.ajax 。请求成功时可调用回调函数。参数为:url,[data],[callback],[type] 相对应的参数类型为String,Map,Function,String:

     ●url:发送请求地址。

     ●data:待发送 Key/value参数。

     ●callback:发送成功时回调函数。

     ●type:返回内容格式,xml,html, script, json, text, _default)

     新建一个jsp文件jqueryDemo.jsp,代码如下所示:

复制代码 代码如下:

pageEncoding="GB18030"%>




jquery


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!