Home > Article > Web Front-end > Solutions to the limitations of using jsonp in jquery ajax_jquery
jsonp solves the problem of cross-domain ajax calls. Why do we need to make cross-domain ajax calls? In this way, one application can directly call the API of another application (under a different domain name) through js on the front end.
We have also used jsonp in practical applications, but we only knew one limitation of jsonp before. It can only send get requests. The disadvantage of get requests is that the request length is limited.
Today, I discovered another limitation of jsonp (in the context of jquery ajax) - the error callback of $.ajax will not be triggered. The sample code is as follows:
Copy code
The code is as follows:
The code is as follows: