How to make a plug in this script?

There is a script like this:
var auto_refresh = setInterval(
function ()
{
$('#view_chats').load('chat-records.php').fadeIn(3000);
}, 1000);

The problem is that when the page first loads the records begin to appear in a second, i.e. with a delay. How to make a stub (Loading for example.) when you first load the page until you see the recording?
April 19th 20 at 12:31
1 answer
April 19th 20 at 12:33
To call the function without the setInterval

Find more questions by tags JavaScript