You will get this behavior when the JSONP timeout expires (this is two seconds, according to your timeout: 2000 string), but the data arrives after the timeout expires.
JSONP does not use regular XmlHTTPRequest. To execute JSONP, jQuery inserts a script tag into your document and creates a temporary function to process the script tag (the function name is a long random string in the error message).
When your timeout occurs and the script has not finished loading, jQuery discards the temporary function. After that, the script tag finishes loading and tries to call this function - but too late the function was deleted. Hence the error.
You may be able to get fewer errors by increasing the latency, but the main problem is that you cannot cancel the loading of the script tag. If he was not mistaken, there is always a chance that it will take a little longer than your timeout. As far as I know, there is no neat solution for this. You can tell jQuery to use the explicitly named function as a JSONP callback instead of creating your own, but then you will need to keep track of whether this thing was a timeout on its own. You can use CORS, which is another whole.
It is probably best to live with him.
Daniel Baird
source share