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 6112557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:45:30+00:00 2026-05-23T14:45:30+00:00

I’ve searched for a solution for two days and I can’t take it anymore.

  • 0

I’ve searched for a solution for two days and I can’t take it anymore. I apologize in advance for the length of this question. I’m not trying to overwhelm anyone, I just wanted to make sure to include everything you might need to help me. Thanks in advance. So now for my question:

Situation:

On the left side of my Project Management page, I have two small forms. One to add Milestones, the other to add Tasks/Todos. On the right side of the page, I am showing the Project as it is being built (by adding milestones and tasks).

I am successfully submitting the forms via Ajax. But NO MATTER WHAT I DO, I am unable to have the “results” (right side of the page) reflect the updated content without having to refresh the page (which defeats the purpose of using ajax in the first place). It seems that I am unable to understand the .ajaxComplete or how to properly fill out the success: portion of the $.post command.

I have tried too many variations to post here, so I’ll just include my latest attempt:

javascript

$(document).ready(function() {
    $("#results").load("i/getAllInfo.class.php");

    $('#loader').hide()

    .ajaxStart(function() {
        $(this).show();
    })
    .ajaxStop(function() {
        $(this).fadeOut(1000);
    });
});

function addMilestoneForm() {
    $.post("i/addMilestone.php",
    $("#addMilestoneForm").serialize());
};

function addTodoForm() {
    $.post("i/addTodo.php",
    $("#addTodoForm").serialize());
};

PHP

i/getAllInfo.class.php

<?php
include("database.php");

class getAllInfo
    {
        public function getProjectInfo()
            {
                global $db;
                $projectId = "1";
                $qProject = sprintf("SELECT * FROM projects WHERE id = '%s'",
                                    mysql_real_escape_string($projectId));
                $qProjectResult = mysql_query($qProject);
                return $qProjectResult;
            }

        public function getMilestoneInfo($projectName)
            {
                global $db;
                $qMilestone = sprintf("SELECT * FROM milestones WHERE projectName = '%s' AND complete = 0",
                                mysql_real_escape_string($projectName));
                $rMilestone = mysql_query($qMilestone);
                return $rMilestone;
            }

        public function getTodoInfo($msId)
            {
                global $db;
                $qTodo = sprintf("SELECT * FROM todos WHERE id = '%s' AND complete = 0",
                            mysql_real_escape_string($msId));
                $rTodo = mysql_query($qTodo);
                return $rTodo;
            }
    }
$g = new getAllInfo();

$pInfo = mysql_fetch_object($g->getProjectInfo());
$theProjectName = $pInfo->projectName;
$theProjectSummary = $pInfo->summary;

$rM = $g->getMilestoneInfo($theProjectName);
echo '<h2>' . $theProjectName . '</h2>';

while ($row = mysql_fetch_object($rM))
    {
        $msId = $row->id;
        $milestone = $row->milestone;
        $msEtaTime = $row->etaTime;
        $msEtaScope = $row->etaScope;
    ?>
        <ul style="float: left; clear: left; width: 85%; margin-left: 2%; margin-right: auto; margin-bottom: 10px;">
                <p><b><?php echo $milestone; ?></b><br />
                ETA: <?php echo $msEtaTime . ' ' . $msEtaScope; ?></p>

            <?php
                $rT = $g->getTodoInfo($msId);
                while ($row = mysql_fetch_object($rT))
                    {
                        $todo = $row->todo;
                        $dep = $row->dependency;                                
                ?>
            <li>
                <span>
                    <a href="todos/index.php?todo=<?php echo $todo; ?>"><?php echo $todo; ?></a>
                    <span class="dependency">
                        <span class="innerDep"><?php echo $dep; ?></span>
                    </span>
                </span>
            </li>
                <?php
                    }; ?>
        </ul>
    <?php
    }; ?>

i/addMilestone.php

<?php
include("database.php");
global $db;

$theProjectName = htmlentities($_POST['projectName']);
$milestoneName = htmlentities($_POST['milestoneName']);
$etaTime = htmlentities($_POST['milestoneEtaTime']);
$etaScope = htmlentities($_POST['milestoneEtaScope']);              

$query = sprintf("INSERT INTO milestones (projectName, milestone, etaTime, etaScope) VALUES ('%s', '%s', '%s', '%s')",
            mysql_real_escape_string($theProjectName),
            mysql_real_escape_string($milestoneName),
            mysql_real_escape_string($etaTime),
            mysql_real_escape_string($etaScope));

$result = $db->query($query);
if (!$result)
    {
        return false;
    }
else
    {
        return true;
    }
?>

i/addTodo.php

<?php
include("database.php");
global $db;

$milestoneId = htmlentities($_POST['addToMilestone']);
$todo = htmlentities($_POST['todoName']);
$etaTime = htmlentities($_POST['etaTime']);
$etaScope = htmlentities($_POST['etaScope']);

$query = sprintf("INSERT INTO todos (id, todo, etaTime, etaScope) VALUES ('%s', '%s', '%s', '%s')",
            mysql_real_escape_string($milestoneId),
            mysql_real_escape_string($todo),
            mysql_real_escape_string($etaTime),
            mysql_real_escape_string($etaScope));           

$result = $db->query($query);

if (!$result)
    {
        return false;
    }
else
    {
        return true;
    }
?>

HTML

the relevant code (two forms, result section, etc.)

<section id="content">
        <span id="loader"></span>
        <span id="alertBox"></span>
        <section id="accordion">
            <form id="addMilestoneForm" style="margin-bottom: 10px;" onsubmit="addMilestoneForm(); return false;">
                <fieldset>
                    <h4>Milestones</h4>
                    <ul>
                        <li>
                            <label for="milestoneName">Name: </label>
                            <input type="hidden" name="projectName" value="FML" id="projectName" />
                            <input type="text" name="milestoneName" value="" id="milestoneName" />
                        </li>
                        <li>
                            <label for="milestoneEtaTime">ETA: </label>
                            <input type="text" name="milestoneEtaTime" id="milestoneEtaTime" style="width: 55%;" />
                            <select name="milestoneEtaScope" id="milestoneEtaScope">
                                <option value="minutes">minutes</option>
                                <option value="hours">hours</option>
                                <option value="days">days</option>
                                <option value="weeks">weeks</option>
                                <option value="months">months</option>
                                <option value="years">years</option>
                            </select>
                        </li>
                    </ul>
                </fieldset>
                <fieldset>
                    <button type="submit" formname="addMilestoneForm">Add</button>
                </fieldset>
            </form>
            <form id="addTodoForm" onsubmit="addTodoForm(); return false;">
                <h4>Todo's</h4>
                <fieldset>
                    <ul>
                        <li>
                            <select name="addToMilestone" id="msSelect"></select>
                        </li>
                        <li>
                            <label for="todoName">Name: </label>
                            <input type="text" name="todoName" id="todoName" />
                        </li>
                        <li>
                            <label for="etaTime">ETA: </label>
                            <input type="text" name="etaTime" value="" />
                            <select name="etaScope">
                                <option value="minutes">minutes</option>
                                <option value="hours">hours</option>
                                <option value="days">days</option>
                                <option value="weeks">weeks</option>
                                <option value="months">months</option>
                                <option value="years">years</option>
                            </select>
                        </li>
                    </ul>
                </fieldset>
                <fieldset>
                    <input type="submit" value="Add" />
                </fieldset>
            </form>
        </section>
        <section id="results"></section>
    </section>
  • 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-23T14:45:31+00:00Added an answer on May 23, 2026 at 2:45 pm

    You just need to include a closure as your third parameter to $.post, i.e.

    function addMilestoneForm() {
      $.post("i/addMilestone.php",
          $("#addMilestoneForm").serialize(),
          function(data, textStatus, jqXHR) {
             $('#results > ul').append(data);
          }
      );
    };
    

    Also, your wrapper for initializing jQuery should be like this

    $(function() {
        $("#results").load("i/getAllInfo.class.php");
    
        $('#loader').hide()
        .ajaxStart(function() {
            $(this).show();
        })
        .ajaxStop(function() {
            $(this).fadeOut(1000);
        });
    });
    

    Rather than

    $(document).ready(function() {})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

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.