I am currently working on a JSON loop that retries connection 3 times before triggering an error. However, I have encountered a situation where multiple JSON requests are made, resulting in several alerts being displayed in my phonegap app.
For example:
function showJSONerror(xhr, status) { if (xhr.status === 0 && localStorage["TmpAlertShow"] !== true) { navigator.notification.confirm('Connection error.\n Verify your network connection and try again.', confirmAction, 'Woops...','Try Again, Close'); localStorage["TmpAlertShow"] = true; function confirmAction(button) { if (button == 1) { localStorage["TmpAlertShow"] = false; showPage(localStorage["TmpWebView"]); } if (button == 2) { localStorage["TmpAlertShow"] = false; return false; } } } }
I am looking for a solution to either close previous alerts using JavaScript or keep track of whether an alert has already been triggered and not closed to prevent displaying multiple alerts.
Thank you