Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7618621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:27:07+00:00 2026-05-31T03:27:07+00:00

I am making a dynamic questions forum and I want to refresh only the

  • 0

I am making a dynamic questions forum and I want to refresh only the listing of the topics when a user ads a new topic , I do not want to refresh the entire page. Is that possible?

This is my markup for the table where the posts are listed:

<table class="topics">
    <tr>
        <th width="5%"></th>
        <th width="45%"><a href="">Subject</a></th>
        <th width="15%"><a href="">Author</a></th>
        <th width="10%"><a href="">Replies</a></th>
        <th width="10%"><a href="">Views</a></th>
    </tr>
    <?php foreach ($discussions as $discussion) : ?>
    <tr class="alt">
        <td><a href=""><img src="<?= site_url('assets/images/featured-posts-icon.png') ?>" /></a></td>
        <td><a href="<?= site_url('discussion/test/' . $discussion->stub) ?>" class="subject"><?php echo $discussion->title; ?></a></td>
        <td><a href=""><?php echo $discussion->author; ?></a></td>
        <td><?php echo $discussion->replies; ?></td>
        <td><?php echo $discussion->views; ?></td>
    </tr>
    <?php endforeach; ?>
</table>

Markup for adding a new post:

<input type="text" name="topic" id="topic" />
<ul class="editor-tools">
    <li class="bold"></li>
    <li class="italic"></li>
    <li class="underscore"></li>
    <li class="list"></li>
    <li class="quote"></li>
</ul>
<textarea id="thread-content"></textarea>
<a href="" class="button create-discussion">Start discussion</a>

I am fetching the posts with php. Now when I add a new post with ajax I have the following code:

$('a.create-discussion').on('click', function(e){
    e.preventDefault();
    var title = $('input#topic').val(),
        courseId = 1,
        message = $('textarea#thread-content').val();

    $.ajax({
        type : 'POST',
        url : ROOT_PATH + 'main/ajaxjson/create_discussion',
        data : {title: title, courseId: courseId, message: message},
        dataType: 'json'
    }).done(function(result){
        // do something here?
    });
})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:27:08+00:00Added an answer on May 31, 2026 at 3:27 am

    you basically need to PUSH the stuff to the client

    you can use these 3 methods

    1. from all the pages you can keep making an ajax call to check if a
      new topic is added (long polling)
    2. you can try using COMET
    3. there is something called web-sockets in the modern browsers u can give it a try

    you can implement long polling like this

      window.setInteval("func()",10000);
    
      function func()
      {
          //ajax call to you server which returns the latest posts
          str = xhr.responseText;
    
          if(str)
          {
               document.getElementById("id").innerHTML += str;
          }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm planning on making some dynamic PHP websites and I need a free Authentication
I'm having difficulty making a dynamic AJAX form submition method for .NET WebServices. The
Okay, so I'm making a dynamic 2D array in Java that implements the java.util.Collection
I'm totally familiar in making static and dynamic websites. However, I have never dealt
Did you used Dynamic websites before? you see its a good way for making
Making a new site but something is happening to it in IE8. The social
Making a new site but something is happening to it in IE. I've purchased
Making a simple application, so when the user logs out of Windows, it of
Theres a web page I'm making which content is very dynamic and so I'm
I am making use of dynamic queries in mongoDB, by using them this way:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.