简体   繁体   中英

how do i refresh the div after a click function using jquery?

im trying to refresh a div on the page using jquery after a click function:

$('.finishTag').live('click', function() {
           $('#Qtopics').hide();
            //refresh #hiddenTopic here im stuck here :))
           $('#hiddenTopic').show();

            });

EDIT:

i mean refresh the div once!! and then show it because its hidden at this point!!!

<div id="hiddentTopic">
 <?php

       while ($Qtopic = mysql_fetch_array($getTopics)){
         echo "<a href='google.com' class='topicBullet'>".$Qtopic['name']."</a>";
             }
?>
       </div>

use load

$('#hiddenTopic').load("server.php");

check your id that is with t

hiddentTopic

please change it

hiddenTopic

like this

working demo

http://jsfiddle.net/JLyay/1/

and this is not a refresh this is called hide and show

If I understood it right, you wanna reload content, generated by php part. It's impossible because php is a server-side part while javascript - client-side. What you neeed is to make file server.php , move php part there and then use $('#hiddenTopic').load("server.php"); As @gowri said before.

IF you want to change the formating of div you can do that using any css class like this: $('divId').addClass('class_name');

to add data you can pick the div using divid and update its innet paragraph aur heading text like this:

$('div1 p').html(' blah blah any text … '); $('h2').text(' blah blah blah blah …');

$(' START! ').prependTo('#divID'); (it write START before div) $(' END! ').appendTo('#divID'); (it write END after div)

hope this ll help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM