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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:23:47+00:00 2026-06-09T21:23:47+00:00

I was trying to include two variables along with a serialized form in a

  • 0

I was trying to include two variables along with a serialized form in a $.post call, and the only way I’ve found to do that is instead use serializeArray() rather than serialize(), and then add the extra variables into the array. All of the form elements are being processed correctly, but the extra two variables (order and column) are not.

JQ:

        var order = 'asc';
        var column = 'description';

        $('#task_form').submit(function(e){
            var formData = $("#task_form").serializeArray();
            formData.push({column: column, order: order});

            $.post('process.php', formData, function(data){
                // clear the current task table
                $('#tbody').empty();
                // refresh the task table with the newly inserted task
                $(data).appendTo('#tbody');
                $('#tasks_table').trigger('update');
                $("#description_text").val('');
            });
            e.preventDefault();
        });

PHP:

if(isset($_POST['description_text'])){
    $description = $_POST['description_text'];
    $duration = $_POST['duration_text'];
    $deadline = $_POST['deadline_text'];
    $order = $_POST['order'];
    $column = $_POST['column'];
    TaskDB::createLog($order.' '.$column);

    // convert the date
    $pieces = explode('/', $deadline);
    $month = $pieces[0];
    $day = $pieces[1];
    $year = $pieces[2];

    $newDate = $year.'-'.$month.'-'.$day;
    // create a new task object, add it to database
    $task = new Task('DEFAULT', $description, $duration, $newDate, '0');
    TaskDB::addTask($task);
    TaskDB::generateTaskTable();
}

Anyone know why this is?

  • 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-06-09T21:23:49+00:00Added an answer on June 9, 2026 at 9:23 pm

    According to the serialize array documentation (http://api.jquery.com/serializeArray/) you need to reformat your appending to the array.

    It takes name,value pairs.

    You’d want to format your appends like so:

    formData.push({name: "column", value: column});
    

    And I’m sure you can figure out the rest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to include a .php file that will generate a form for
I'm trying to call a function that catches variables value on call: the function:
I am trying to include two endpoints in my WCF web based service -
I'm trying to multiply two matrices using vecLibs' cblas: #include <stdlib.h> #include <string.h> #include
I'm trying to write a single query which will include one of the two
I'm trying to share the same variable between two .cpp files, they include the
I'm trying to use two buttons to cycle through an array of images. I'm
I am trying to make a class that contains two other objects, and those
I am trying to execute two sql statements in a row. EDIT:Only the first
I am trying to use a textarea form entry which I have some javascript

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.