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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:58:55+00:00 2026-05-27T00:58:55+00:00

i have a javascript object declared something like: var myObject = {a:{b: c, d:

  • 0

i have a javascript object declared something like:

var myObject = {"a":{"b": "c", "d": "e"}, "f":{"g":{}, "h":{}}};

I’m using jQuery’s

$.post(url, myObject, function(){});

to send the data to my php file. for some reason, the empty properties are not being passed, so, because “g” and “h” are empty, even “f” is not passed in the post.

Is there any way i can include them without filling it with bogus data?

thanks

  • 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-27T00:58:56+00:00Added an answer on May 27, 2026 at 12:58 am

    I think that your problem is not with JavaScript. When you call “$.post()” like that, your object will be turned into a HTTP query form with the equivalent of “$.param”:

    var params = $.param({"a":{"b": "c", "d": "e"}, "f":{"g":{}, "h":{}}});
    

    That string looks like:

    a%5Bb%5D=c&a%5Bd%5D=e&f%5Bg%5D=&f%5Bh%5D=

    which, decoded, is:

    a[b]=c&a[d]=e&f[g]=&f[h]=


    edit — well that’s odd. Internally, jQuery is indeed setting up the parameters as I wrote above, but for whatever reason Firefox is stripping out the empty ones. If I add a “beforeSend” handler, it’s clear that the parameters are all there, those with values as well as those without. However, when the actual HTTP request goes out, they’re gone.

    You could attach the parameters to the URL if you don’t mind them going out on the wire that way.

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

Sidebar

Related Questions

I have javascript object defined like this: function SocialMiner() { var verbose=true; var profileArray=new
I have a javascript object as such (simplified). var MyObject = (function(){ var propertyOne
I have a JavaScript object like var obj = { key1: 'value1', key2: 'value2',
I have some javascript code (within an object) : toggle: function() { var me
I have a Javascript object literal: var Toolbar = { init: function(toolbar) { this.Bar
I am trying to have a javascript object tree behave like a php associative
I have a rails template (.rhtml file) generating a Javascript object. It looks something
I have a javascript that does this (http is your XMLHttpRequest object) var r
I currently have a Javascript function that uses a string to reference an object
I have a JavaScript object like: appointerment= {ids: '15,16,17', appointments: {'15': '12.05.2010,14,05,2010'} } now

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.