Some corrections you should take into account.
async: false
is deprecated, no longer used, was a bad idea of the old that was removed, deprecated.
- uses
$(document).ready(
in time of $('#openTickets').ready(
, because if you use it as it is jQuery will not find this element if the HTML has not been read, while document
is global, made available to Javascript since the beginning of page loading
- the
$.ajax
is signing what means you have to use the callback success
- to change content of HTML elements with jQuery uses
.html()
or .text()
, to change the value of elements that can receive value from the user is used .val()
. In the case of a Heading you must use .html()
or .text()
.
So your code can be like this:
$(document).ready(function() {
$.ajax({
time: 15,
url: "/opened-tickets",
dataType: "JSON",
success: function(res) {
$('#openTickets').html(res.responseJSON);
}
});
});
Note: I don’t see where you’re going data
to ajax, I assume that there is no need.
Try using html() instead of val()
– Fleuquer Lima
Another alternative is to use text() instead of val()
– João
@Fleuquerlima It worked, thank you :D
– Felipe Paetzold