I Love Stackoverflow
I Love Stackoverflow

Reputation: 6868

Refresh div every seconds with ajax and show new div with existing div

I have 1 web page where I want to display list of users joined to my web site and connections between them.

I have users and connections between them:

 var data=[
           {
              "Id": 38,
               "Connections":[39,40],
               "Name":"ABc"
          },
           {
              "Id": 39,
               "Connections":[40],
               "Name":"pqr"
           },
           {
               "Id": 40,
               "Connections":[],
               "Name":"lmn"
           }]

In the above example user with Id:38 is connected to user 39 and 40 and user 39 is connected to user 40 and user 40 is already connected to user 39 and user 38 so user 40 Connection array is blank.

I have a web service which I will fires every 1-2 seconds to display newly joined users on this page and new connection between existing users which I have stored in my table and this web service will fetch all users along with their connections.

So at first my page will load but after then my page will not refresh and new users should be displayed and new connections should be connected with AJAX call to my web service.

So far I have been successfully manage to display users and connection between them but now stuck with auto refresh div in 1-2 seconds so that new connections are made without making previous connections.

Right now what happening is when I refresh my div previous connections are made again.

I am using this plugin:Jquery-connections.js

This is one demo which I made; please ignore js which i have kept in html because that is plugin (Jquery-connections.js):JS bin Demo

Upvotes: 1

Views: 345

Answers (1)

Dipak
Dipak

Reputation: 6940

As per the discussion points we have reached to resolve the issues :

  • replace div elements with canvas to ease and faster rendering.
  • use Third party js library for rendering nodes and edges into canvas.

Upvotes: 1

Related Questions