JQuery learning notes (1) -- using jQuery to Implement Asynchronous Communication (using json to pass values) _ jquery

Source: Internet
Author: User
This is a simple POST Request function to replace complex $. ajax: You can call the callback function when the request is successful. If you are interested, refer to the following. I hope jQuery is a popular js library, it can use simple code to make the desired results, as the official website says "write less, do more ". To a certain extent, Jquery has rewritten the previous JavaScript writing method. I used jquery to implement the asynchronous communication effect using ajax in the previous article, and feel the charm of jquery.

First, you need to download jquery's latest js file and introduce it into the file. You can also download it here: Click here to download it.

This communication uses jquery's jQuery. post (url,[Data],[Callback],[Type]) Method, which is a simple POST Request function to replace complex $. ajax. You can call the callback function when the request is successful. Parameters: url, [data], [callback], and [type] correspond to the following parameter types: String, Map, Function, String:

Url: Send request address.

Data: Key/value parameter to be sent.

Callback: Callback function when sending successfully.

Type: Returned content format, xml, html, script, json, text, _ default)

Create a jqueryDemo. jsp file. The Code is as follows:

The Code is as follows:


<% @ Page language = "java" contentType = "text/html; charset = GB18030"
PageEncoding = "GB18030" %>




Jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.