Currently I am pulling a JSON feeds from numerous APIs using jQuery, but what is the best way to handle the possibility of a service not responding or timing out because of their server? Would it be better to cache the JSON 开发者_开发技巧on your server? I'm using PHP/MySQL so I'd like to see an example if a server-side solution is the way to go.
The best way to handle it would be to display a message to the user that says something like "Sorry, the server could not be contacted. This probably isn't your fault." Is that what you meant? If not, try giving more detail in your question.
You should definitely cache the JSON on the server, if it makes sense to do so. You should cache everything when it makes sense to do so.
精彩评论