Reputation: 149
Im building a website where the user uses ajax calls in order to update the database. Its works well on xammp but im worried that problems may happen frequently when the site will be on the net. i've got some questions:
Upvotes: 0
Views: 139
Reputation: 1722
If ajax fails (and my code is good), is it always because of connections?
An Ajax call can fail for a variety of reasons. Reasons can be, but are not limited to: Javascript error, Network Timeout, Serverside error, JS Performance, Browser settings, etc
Can an attempt fail but succeed later?
If your AJAX request fails it will not automaticly retry. You need to program that yourself.
What is the best way to handle those failed requests?
You should have error handling in javascript to check for the errors. Basicly there are 3 cases:
You can either notify the user of a failed request or retry a few times and notify the user later, if the request never completes.
Upvotes: 1