Thank you for the reply mike! I added this to my script: $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { $('#thankyou').show('slow'); $('#newcomment').hide('fast'); $('#newestcomment').show('slow');
}); }); and did this with the div: <div id="newestcomment" style="display:none;"> <a href="#"><? echo $_POST["name"]; ?></a><? echo $_POST["comment"]; ? > </div> It did not seem to pull the data from post, but it does add another space for a comment. The way my form is processed is it send the post info to comment.php and that adds it to the database. How do i have the jquery talk to the php. I tried using a get from an external php page that pulls the latest comment from the database but I didn't know where to go after that. Thank you! -Chris On Jul 15, 6:06 am, "Mike Alsup" <[EMAIL PROTECTED]> wrote: > Sorry, I'm meant the formatted *comment*. When a comment is posted, > return something like this from the server (filling in the correct > info as appropriate): > > <div class="oddcomment"> > <p><a href="#">author name here</a></p><p>Comment text here</p> > </div> > > Mike > > On 7/15/07, Chris <[EMAIL PROTECTED]> wrote: > > > > > Thank you for the reply mike, > > Unfortunately I don't understand how I could use this? What is the > > formatted column? I think i understand that you would be running this > > code $('#comments h1') after the (data) for the form is complete. > > > On Jul 13, 4:17 am, "Mike Alsup" <[EMAIL PROTECTED]> wrote: > > > Chris, > > > > Why don't you return the formatted column when it is posted. Then you > > > could do something like this: > > > > $(document).ready(function() { > > > $('#myForm').ajaxForm(function(data) { > > > $('#thankyou').show('slow'); > > > $('newcomment').hide(); > > > $('#comments h1').after(data); > > > }); > > > > }); > > > > Mike > > > > On 7/13/07, Chris <[EMAIL PROTECTED]> wrote: > > > > > Hello everyone, > > > > I'm a bit of a noob to this whole AJAX thing so you'll have to forgive > > > > me. I've setup a blog, using jQuery the comments are added to mysql > > > > using this form plugin (http://www.malsup.com/jquery/form/#getting- > > > > started). Posting the comments work great, I was even able to add in > > > > a confirmation saying "Thank you for posting". My dilemma is showing > > > > the new comment on the page without refreshing. Here is the page to > > > > test it: (http://www.iphoneappr.com/index.php?post=48). I was > > > > thinking I could do a $.get to an external php page that queries > > > > mysql with the most current post and put it in a specific div on the > > > > page. > > > > Here is the function for the form. > > > > > <script type="text/javascript"> > > > > // wait for the DOM to be loaded > > > > $(document).ready(function() { > > > > // bind 'myForm' and provide a simple callback function > > > > $('#myForm').ajaxForm(function() { > > > > $('#thankyou').show('slow'); > > > > $('#newcomment').hide('fast'); > > > > > }); > > > > }); > > > > > </script> > > > > > Thank you for any help! This is driving me nuts!!!!!