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

  • Home
  • SEARCH
  • 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 6563191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:48:01+00:00 2026-05-25T13:48:01+00:00

I am generating the html using JSON file. Now I need to pass data

  • 0

I am generating the html using JSON file. Now I need to pass data to the servlet. But the data being passed shows null. I am using jQuery post to pass the data.

My js file has

   $.getJSON('input.json',function(data)
 {
$.each(data,function(j,feild)
        {
            if(this.type=="checkbox")
            {   

            $('body #tabs #tabs-3 #server').append(this.display_name).append(INPUT_CHECKBOX).attr({name:this.name,type:this.type}).append(NEWLINE);
            }       
            else
                if(this.type=="radio")
                {   
                    var radio = '';    
                    var len = feild.values.length; 
                    for (var i = 0; i< len; i++)
                    {        
                        radio +='<input type="radio" name="group2">'+feild.values[i];  
                    }
                    $('body #tabs #tabs-3 #server').append(this.display_name).append(radio).attr({name:this.name,type:this.type}).append(NEWLINE);
                }
        });

The post method contains

function forwarddata()
{
alert('inside the function');
$.post('url', 
      {gender:$('input[type=radio]').val(),
       items:$('input[type=checkbox]').val()!= undefined,
       stores:$('input[type=checkbox]').val()!= undefined
      });
}

Myjson file has

{
"gender":
                   {"display_name":"gender:",
                    "name":"gender",
                    "format":"string",
                    "type":"radio",
                    "format":"string",
                    "values":["male","female"],
                    "isMandatory":"true"
                    },


"items":  
                   { "display_name":"items:",
                     "name":"items",
                     "format":"string",
                     "type":"checkbox",
                     "values":[1,2,3,4],
                     "isMandatory":"true"
                    },


"stores":                       
                   { "display_name":"stores:",
                     "name":"motion",
                     "format":"string",
                     "type":"checkbox",
                     "values":[a,b,c,d],
                     "isMandatory":"true"
                    }

}

When I try printing the data in the servlet it says null… Kindly explain the correct way of posting the data.

  • 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-25T13:48:02+00:00Added an answer on May 25, 2026 at 1:48 pm

    I changed my JSON data.Added name attribute and the below function worked just fine
    Thanks:)

     function forwardserverdata()
    {
    alert('inside the function');
    $.post(''url, 
          {gender:$('body #tabs #tabs-3 #server input:radio[name=gender]:checked').val(),
           items:$('body #tabs #tabs-3 #server  input:checkbox[name=items]:checked').val()!= undefined,
           stores:$('body #tabs #tabs-3 #server input:checkbox[name=stores]:checked').val()!= undefined
          });
    

    }

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

Sidebar

Related Questions

I'm generating HTML elements on the fly using javascript. These controls are located within
I am using a popup plugin to open my popup window. Generating html table
i am dynamically generating a html page using php in which i am generating
Im searching a Template Lib or Template Engine for generating HTML (XML) that runs
Is there a way of automatically generating a HTML-Map compatible list of coordinates of
I am trying to find the best practice for generating and outputting html which
I am generating a document from HTML. Is there any way to force the
While generating charts using RS 2008 betas, RC0 and such., I never specified any
When generating graphs and showing different sets of data it usually a good idea
I'm generating ICalendar (.ics) files. Using the UID and SEQUENCE fields I can update

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.