I have a page in which a user is asking a question after watching video. I want to update the number of questions asked as soon as any user asks question. I do not want to reload the whole page. I only want to update that specific div which is containing all questions.
I have a page in which a user is asking a question after watching video. I want to update the number of questions asked as soon as any user asks question. I do not want to reload the whole page. I only want to update that specific div which is containing all questions.
Share Improve this question edited Sep 13, 2012 at 5:36 Daedalus 7,7225 gold badges38 silver badges63 bronze badges asked Sep 13, 2012 at 5:30 ShailendraShailendra 5672 gold badges5 silver badges11 bronze badges2 Answers
Reset to default 8You can use jQuery.load()
for this.
For example, wherever you want to refresh some div with id=questions
, you do this:
jQuery('#questions').load('/some_url #questions > *');
You add a page to you server which returns only your questions.
e.g. your full page contains
<div id="questions"></div>
then you design a page /questions.php on your server which returns only what is supposed to be in that div
with jquery.load you fill the questions div
<script>$(function(){ $("#questions").load("/questions.php") })</script>