Use ajax to request the server to load the data list and prompt the loading method. ajaxloading

Source: Internet
Author: User

Use ajax to request the server to load the data list and prompt the loading method. ajaxloading

We use weui. loading in weui. js as the effect. The beforeSend and complete methods of ajax will take several seconds to load data...

JS files to be loaded on the page:

<Script src = "../js/libs/weui. min. js"> </script>

You can go to weui's document to download, this is its demo: https://weui.io/weui.js/

Here we mainly talk about get of jQuery ajax. When querying data, its structure is:

$. Ajax ({type: 'get', url: url, data: data, ype: 'json', contentType: 'apllication/json; charset = UTF-8 ', // method called before data loading beforeSend () beforeSend: function (data) {// here, if no data is loaded, the loading if (data. readyState = 0) {weui. loading ('loading') ;}}, // Method for successful data loading call sucess () sucess: function (data) {// after data is written and loaded successfully, code to be executed}, // method called after the data is loaded successfully complete () complete: function (data) {// determine here. After the data is loaded successfully, loading hides if (d Ata. status = 200) {setTimeOut (function () {weui. loading ('loading '). hide () ;}, 500) ;}, // method called after an error in data loading: error () error: function (data) {weui. topTips ('data loading failed! ');}})

When I use ajax to request the server to load the data list, I am prompted that the loading method is all the content that I have shared with you. I hope you can give me a reference and support the help house a lot.

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.