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.