Which is the better underlying function than getjson and what are its advantages?
In this issue, Xiaobian will bring you about which underlying function is better than getjson and what advantages it has. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.
The code is as follows:
$.ajax({
type: "GET",
url: desturl,
success:function(data) {
if(data!= '') {
linfo[xss_clean]=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, you can tell the user that there is an error through the error method, and if you use the getjson function, you cannot handle this error.
The above is the bottom function that Xiaobian shares for everyone is better than getjson, which is what and what advantages, if there is a similar doubt, may wish to refer to the above analysis to understand. If you want to know more about it, please pay attention to the industry information channel.