Is there any method of fetching data from a server by putting it directly to a page without having to use a basic javascript example: ??
setInterval(function() {
$.ajax({
type: "POST",
url: "retorno.php",
data: 'id=1',
cache: false,
success: function(html) {
$("div").html(html);
}
});
}, 1000);
Because with this type of example I can not make it more dynamic with the page. EXAMPLE:
If it is to list a conversation between two people, with this code, I can not release a notification sound to alert the new message user.
There is some way of using this kind of code, so make sure to handle it, because on setInterval
the page would be refreshing from time to time, preventing you from parsing the code.
Type the Facebook notification where it appears to be directly on the page and only notifies you when the server has changed.