Encountering an issue with displaying a div notification using the code snippet below:
$.ajax({
url: url,
cache: false,
async: false,
success: function (data)
{
response = jQuery.parseJSON(data);
},
error: function(){
showAlert('contentContainer', { type: 'danger', title: 'Error', text: 'Connection Failed' });
}
});
The problem is that even when the server is down, the div remains hidden. However, the showAlert() method works fine in other instances where there is no network error.
function showAlert(parentDiv, options) {
$alertDiv = $('<div></div>')
.show()
... // Rest of the function as-is
}
...
<p>Console Output:</p>
<pre><code>Failed to load resource http://192.168.182.130:8080/js/jquery-3.1.0.min.js
send jquery-3.1.0.min.js:4
r.extend.ajax jquery-3.1.0.min.js:4
getFromDatabase utils.js:251
(anonymous function) (index):39
r.event.dispatch jquery-3.1.0.min.js:3
q.handle
Any insights on what might be causing this?
Appreciate any help on this!