Which is a better underlying function than getjson? What are the advantages

Time:2021-7-3
Copy codeThe code is as follows:
$.ajax({
type: “GET”,
url: desturl,
success:function(data) {
if(data!=”) {
linfo.innerHTML=data;
}
loadimg.style.display=”none”;
// addTableListener(document.getElementById(“tbColor”),0,0);
},
error: function(){
Alert (“asynchronous query error”);
loadimg.style.display=”none”;
},dataType:”json”

});

The advantage is that if there is a problem with the network, the error method can be used to tell the user that there is an error. If you use the getjson function, you cannot handle this error

Recommended Today

MySQL related

Indexes Bottom structure Disadvantages of hash table index: Using hash storage requires adding all files to memory, which consumes more memory space If all queries are equivalent queries, the hash is indeed fast, but in the actual scene, more data is found, and not all queries are equivalent queries, so the hash table is not […]