The simplest implementation of jquery's ajax effect and the difference between innerhtml () and innertext ()

Source: Internet
Author: User
1. add jquery's js2. to add an action to the element (for demonstration, it is directly written in html): [javascript] & lt; td & gt; customer name: & lt; inputtype & amp; #39; text & amp; #39; id & amp; #39; name & amp; #39; onblur & amp; #39; burFunc () & amp; #39; na

1. Add jquery js

2. Add an action for the element (for demonstration, it is directly written in html ):

[Javascript]
Customer name: 

3. Add a processing function:

[Javascript]
Function burFunc (){
$. Get ('url', {// use the get Method for ajax operations
Name: $ ("# name"). val () // parameters passed to the backend
}, Function (data, textStatus) {// data is the data returned by the backend.
... // Some operations
}, "Json"); // indicates that the data returned by the backend is in json format.
}
4. Run, OK!
In addition, we will briefly introduce the differences between innerhtml () and innertext:

Test. innerHTML:
It also contains all content from the starting position to the ending position of the object, including Html tags.
For example, "test1 ".

Test. innerText:
Content from the starting position to the ending position, but it removes the Html Tag
For example, "test1", where the span tag is removed.

Related Article

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.