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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:34:42+00:00 2026-06-07T17:34:42+00:00

I wander how send post form data in json format via ajax with JQuery

  • 0

I wander how send post form data in json format via ajax with JQuery dynamically?
For example I’m coding something like this in JQ:

$.post("test.php", { func: "getNameAndTime" },
    function(data){
      alert(data.name); // John
      console.log(data.time); //  2pm
    }, "json");

and that’s good, but in live apps often need to send huge form data and user can dynamically change the fields, so I don’t know how many func1, func2, func3 or even func[] will be sent.
The q is how to do this dynamically, in old world of an AJAX I could done it by serealizing the form and send to the server.
Thanx in advance.

  • 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-07T17:34:43+00:00Added an answer on June 7, 2026 at 5:34 pm

    Yes I can send all the data to the server and in any case it will worked well,
    example:

    $(function() { // on document load
    $('#email_form').submit(function() { // set onsubmit event to the form
      var data = $('#email_form').serialize(); // serialize all the data in the form 
      $.ajax({
        url: 'testJson.php', // php script to retern json encoded string
        data: data,  // serialized data to send on server
        dataType:'json', // set recieving type - JSON in case of a question
        type:'POST', // set sending HTTP Request type
        async:false, 
        success: function(data) { // callback method for further manipulations             
          for (key in data.email) {
            alert(data.email[key]);
          }
    
        },
        error: function(data) { // if error occured
    
        }
      });
      return false;
    });
    

    });

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

Sidebar

Related Questions

I have a form I am creating and I would like to send information,
I was just trying to post something to a website via my localhost to
I'm trying out jQuery to send POST and GET requests to Django. So far
I've seen GDIFF(Generic Diff Format) in wikipedia , and I wander is there any
I send some data from my App to a web service and it replies.
I have to send information too a third party in an XML format they
I wonder how is it possible to send a picture. I am using json
Im using jQuery validate plugin and every form has multiple validation levels. level is
I am writing an API which includes IPC functions which send data to another
I am sending events not as a JSON array, but like this: {result:success, events:[

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.