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

The Archive Base Latest Questions

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

I have the following code: $.post(‘block_ajax.php’ , { ‘action’: ‘set_layout’ , ‘listid’: 123 ,

  • 0

I have the following code:

$.post('block_ajax.php'
    ,   {   'action': 'set_layout'
        ,   'listid': 123
        ,   'layout': []
        }
    ,   function(data) {
            // ...
        }
);

The recieving script (block_ajax.php) only recieves the “action” and “listid” parameters. When I inspect what is sent using Chrome, I see the “layout” parameter isn’t even send to the backend script.

Since there is a difference between an empty array and the absence of an array, I’d like to have JQuery send the empty array. I can find some indications that JQuery (1.6.1) seems to do this, but not how to stop it from doing so. JSON format allows for empty arrays and empty objects, so I think it should be possible.

Does anybody know what to change so JQuery can send empty arrays?

  • 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:29:52+00:00Added an answer on May 23, 2026 at 2:29 pm

    EDIT: See Luke’s answer for a better solution: https://stackoverflow.com/a/31996181/827437

    I’ve left my previous answer specific to how Rails handles [""] below, as the link above explains.


    Note: Rails-specific

    I am not sure why you need to send a blank parameter. Merely checking the existence of the parameter in the PHP script should be enough. However, if you really want to do it, use 'layout': [""] instead of 'layout': []. The parameter should be sent.

    (In addition, you might want to rename layout to layout[] to indicate it’s an array, but this is unnecessary.)

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

Sidebar

Related Questions

I have the following code: <script type=text/javascript> $(document).ready(function() { $(#Save).click(function() { $.post(url, { data:
I have this following code $(function () { $.post(fetch_data.php?url=+$('#url').val(), { }, function(response){ var arrValues
I have the following code: <form action= method=POST> <?php $count = isset($_POST['count']) ? $_POST['count']
I have the following code which is trying to post xml constructed data to
I have the following code; $.ajax({ url: /Home/jQueryAddComment, type: POST, dataType: json, data: json,
I have the following code used to post data to a remote server: NSString
I have the following code: $.ajax({ type: POST, url: url, data: sendable, dataType: json,
I have the following code in my template: <form action= method=post>{% csrf_token %} {%for
I have the following code: function get_login() { hideshow('loading2',1); error(0); $.ajax({ type: POST, url:
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public

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.