0

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>
4
  • 2
    what do you mean by refresh? put some data? Commented Apr 1, 2011 at 11:54
  • edited answer im just trying to refresh the content!!! on #hiddentTopic Commented Apr 1, 2011 at 12:04
  • $('#hiddenTopic').text("Edited content"); or html() Commented Apr 1, 2011 at 12:10
  • After you edit post - You want to rerun php part by javascript? :))) Commented Apr 1, 2011 at 12:11

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

can i ask if i wanted to pass a parameter to server.php like the comment_id so it knows what to access, how can i do that with.load()
Simply $('#hiddenTopic').load("server.php?comment_id=" + comment_id );
1

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

4 Comments

what deos server.php come from!! :))
hiddenTopic div already has content inside it that access the database in php, i just need refresh it!! :)) thanks
@pingpong then what you want to refresh?
why need to refresh it .. which means you need to show latest content right . then just echo your latest content from server.php
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.