Dark Horse Programmer _ using jquery for Ajax functions

Source: Internet
Author: User

What is 1.AJAX?

Ajax technology has been heard, but really used to work for a year, then need to implement an asynchronous update push function. such as: In the file management system, there are agent matters and the station letter, and these modules need to be in the case of the page does not refresh the timing of the feedback to the front desk to do the number of items and brief content, the station letter is the same. This time I think that only Ajax can do it, what is Ajax? Ajax is the technique of exchanging data with a server without reloading the entire page and updating parts of the Web page.

2. Why use jquery to achieve?

Learning to start with ASP, the power of jquery has captured me deeply, and I remember the teacher's words, JavaScript can achieve jquery can also be achieved, but also because it is packaged for us to use, so and its convenience.

3. How to use jquery to achieve

1. Use jquery's own function: $.ajax ([Settings]); You need to provide common parameters in parentheses, such as: type,url,data,datatype,success, etc.

2. Explanation of parameters:

Type: A parameter of type string is required, and the request method (post or get) defaults to get. Note Other HTTP request methods, such as put and delete, can also be used, but only some browsers support it.

URL: The requested address is requested for a parameter of type string, (the current page address is assumed to be the default).

Data: A parameter that is required to be an object or string that is sent to the server. If it is not already a string, it is automatically converted to a string format. The GET request will be appended to the URL. To prevent this automatic conversion, you can view the ProcessData option. The object must be in key/value format, for example {foo1: "Bar1", Foo2: "Bar2"} to &foo1=bar1&foo2=bar2. In the case of arrays, jquery automatically corresponds to the same name for different values. For example {foo:["Bar1", "Bar2"]} is converted to &FOO=BAR1&FOO=BAR2.

DataType: A parameter of type string is required and the expected data type is returned by the server. If not specified, jquery automatically returns Responsexml or ResponseText based on the HTTP packet mime information and is passed as a callback function parameter.

Success: A callback function called after a successful request for a parameter of function type, with two parameters. (1) The data returned by the server and processed according to the datatype parameter. (2) A string describing the status.

3. For example:

$.ajax ({

})



For more details, see: <a href= "http://www.itheima.com" target= "blank" >www.itheima.com</a>

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.