Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get data notifacation realtime use ajax good

$(window).load(realTime);
    function realTime() {
        $.ajax({
            type:'post',
            url:'/chat/get',
            data:{
                '_token':$('input[name=_token]').val(),
            },
            success: function (data) {
                $('#message').replaceWith(' <ul class="media-list" id="message"></ul>');
                for (var i=0; i < data.length; i++){
                    $('#message').append(' <li class="media"><div class="media-body"><div class="media"><div class="media-body">'+data[i].message+'<br/><small class="text-muted">'+data[i].from_name+'|'+ data[i].created_at+'</small><hr/></div></div></div></li>')
                }
             setTimeout(realTime, 2000);
            },
        });

    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: OpenTok Create Session 
Javascript :: fingerprint 
Javascript :: Create & Download PDF from Byte[] Array using jQuery AJAX 
Javascript :: javasrcipt jpg resize 
Javascript :: roman to integer fastest way 
Javascript :: set display size phaser 
Javascript :: regex tunisian phone number 
Javascript :: phaser increment x layers 
Javascript :: phaser set alpha 
Javascript :: phaser animation from json 
Javascript :: phaser stagger play 2 
Javascript :: refresh secounds 
Javascript :: remove text and keep div inside a div jquery 2 
Javascript :: how to map elements from 1st object react js 
Javascript :: javascript search an array of json for matching attribute 
Javascript :: nestjs TS2339 
Javascript :: nodelist example 
Javascript :: .pop javascript 
Javascript :: last five characters of string javascript 
Javascript :: sveltekit new app 
Javascript :: react native icons 
Javascript :: printing in javascript 
Javascript :: node js post multipart/form-data 
Javascript :: map && arrow function in javascript 
Javascript :: swagger ui express 
Javascript :: java script removing first three indexes 
Javascript :: react native fast image webp ios 
Javascript :: javascript array length 
Javascript :: javascript save multiple images to server 
Javascript :: Using the Set object 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =