PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, September 8, 2022

[FIXED] What is the most efficient way to reload a div without refreshing the whole page in django?

 September 08, 2022     ajax, django, jquery, python     No comments   

Issue

I am looking for the most efficient way that I can present on a live web page data such as a table with data from the database, that when a new record is added to the database the table updates itself without the user having to refresh the page.

I have tried the method with Django and Ajax but I don't find it efficient because it has to refresh at a certain time but I only want it to refresh when a new record is added to the database.

What methods could you recommend?


Solution

With standard Ajax, the client has to initiate the request. If you want the server to be able to "push" to the client without a request from the client, you'll want to use websockets. There's a package called Django Channels for implementing websockets in Django.



Answered By - Kyle Alm
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing