0

I having been working on a project, where when there is a new db update, we are using the .click() function to refresh the page to get new content into view, and that tends to load huge amount of data retrieval for a single update. But I have seen in sites like stackoverflow or linkedin they were loading the new content without refreshing the whole page.

May anyone help on how to add that feature in our project.

1 Answers1

2

Use Ajax for this.

Build a function that will fetch the current page via ajax, but not the whole page, just the div in question from the server. The data will then (again via jQuery) be put inside the same div in question and replace old content with new one.

Relevant function:

http://api.jquery.com/load/

eg

$('#thisdiv').load(document.URL +  '#thisdiv');

Note, load automatically replaces content.

Refernce: Refresh Part of Page (div)

Only update part of page

Community
  • 1
  • 1
Nevin Madhukar K
  • 3,031
  • 2
  • 25
  • 52